pub enum MaybeOwned<'a, T>where
    T: 'a,{
    Owned(T),
    Borrowed(&'a T),
}
Expand description

This type provides a way to store data to which you either have a reference to or which you do own.

It provides From<T>, From<&'a T> implementations and, in difference to Cow does not require ToOwned to be implemented which makes it compatible with non cloneable data, as a draw back of this it does not know about ToOwned. As a consequence of it can’t know that &str should be the borrowed version of String and not &String this is especially bad wrt. Box as the borrowed version of Box<T> would be &Box<T>.

While this crate has some drawbacks compared to Cow is has the benefit, that it works with Types which neither implement Clone nor ToOwned. Another benefit lies in the ability to write API functions which accept a generic parameter E: Into<MaybeOwned<'a, T>> as the API consumer can pass T, &'a T and MaybeOwned<'a, T> as argument, without requiring a explicit Cow::Owned or a split into two functions one accepting owed and the other borrowed values.

Alternatives

If you mainly have values implementing ToOwned like &str/String, Path/PathBuf or &[T]/Vec<T> using std::borrow::Cow might be preferable.

If you want to be able to treat &T, &mut T, Box<T> and Arc<T> the same consider using reffers::rbma::RBMA (through not all types/platforms are supported because as it relies on the fact that for many pointers the lowest two bits are 0, and stores the discriminant in them, nevertheless this is can only be used with 32bit-aligned data, e.g. using a &u8 might fail). RBMA also allows you to recover a &mut T if it was created from Box<T>, &mut T or a unique Arc.

Examples

struct PseudoBigData(u8);
fn pseudo_register_fn<'a, E>(_val: E) where E: Into<MaybeOwned<'a, PseudoBigData>> { }

let data = PseudoBigData(12);
let data2 = PseudoBigData(13);

pseudo_register_fn(&data);
pseudo_register_fn(&data);
pseudo_register_fn(data2);
pseudo_register_fn(MaybeOwned::Owned(PseudoBigData(111)));
#[repr(C)]
struct OpaqueFFI {
    ref1:  * const u8
    //we also might want to have PhantomData etc.
}

// does not work as it does not implement `ToOwned`
// let _ = Cow::Owned(OpaqueFFI { ref1: 0 as *const u8});

// ok, MaybeOwned can do this (but can't do &str<->String as tread of)
let _ = MaybeOwned::Owned(OpaqueFFI { ref1: 0 as *const u8 });
use std::collections::HashMap;

#[derive(Serialize, Deserialize)]
struct SerializedData<'a> {
    data: MaybeOwned<'a, HashMap<String, i32>>,
}

let mut map = HashMap::new();
map.insert("answer".to_owned(), 42);

// serializing can use borrowed data to avoid unnecessary copying
let bytes = serde_json::to_vec(&SerializedData { data: (&map).into() }).unwrap();

// deserializing creates owned data
let deserialized: SerializedData = serde_json::from_slice(&bytes).unwrap();
assert_eq!(deserialized.data["answer"], 42);

Transitive std::ops implementations

There are transitive implementations for most operator in std::ops.

A Op between a MaybeOwned<L> and MaybeOwned<R> is implemented if:

  • L impl the Op with R
  • L impl the Op with &R
  • &L impl the Op with R
  • &L impl the Op with &R
  • the Output of all aboves implementations is the same type

The Neg (- prefix) op is implemented for V if:

  • V impl Neg
  • &V impl Neg
  • both have the same Output

The Not (! prefix) op is implemented for V if:

  • V impl Not
  • &V impl Not
  • both have the same Output

Adding implementations for Ops which add a MaybeOwned to a non MaybeOwned value (like MaybeOwned<T> + T) requires far reaching specialization in rust and is therefore not done for now.

Variants§

§

Owned(T)

owns T

§

Borrowed(&'a T)

has a reference to T

Implementations§

§

impl<T> MaybeOwned<'_, T>

pub fn is_owned(&self) -> bool

Returns true if the data is owned else false.

§

impl<T> MaybeOwned<'_, T>where T: Clone,

pub fn into_owned(self) -> T

Return the contained data in it’s owned form.

If it’s borrowed this will clone it.

pub fn make_owned(&mut self) -> &mut T

Internally converts the type into it’s owned variant.

Conversion from a reference to the owned variant is done by cloning.

This returns a &mut T and as such can be used to “unconditionally” get an &mut T. Be aware that while this works with both MaybeOwned and MaybeOwnedMut it also converts it to an owned variant in both cases. So while it’s the best way to get a &mut T for MaybeOwned for MaybeOwnedMut it’s preferable to use as_mut from AsMut.

Example
use maybe_owned::MaybeOwned;

#[derive(Clone, Debug, PartialEq, Eq)]
struct PseudoBigData(u8);

let data = PseudoBigData(12);

let mut maybe: MaybeOwned<PseudoBigData> = (&data).into();
assert_eq!(false, maybe.is_owned());

{
    let reference = maybe.make_owned();
    assert_eq!(&mut PseudoBigData(12), reference);
}
assert!(maybe.is_owned());
§

impl<T> MaybeOwned<'_, T>

pub fn as_mut(&mut self) -> Option<&mut T>

Returns a &mut if possible.

If the internal representation is borrowed (&T) then this method will return None

§

impl<T> MaybeOwned<'_, T>where T: Clone,

pub fn to_mut(&mut self) -> &mut T

👎Deprecated: use make_owned instead

Acquires a mutable reference to owned data.

Clones data if it is not already owned.

Example
use maybe_owned::MaybeOwned;

#[derive(Clone, Debug, PartialEq, Eq)]
struct PseudoBigData(u8);

let data = PseudoBigData(12);

let mut maybe: MaybeOwned<PseudoBigData> = (&data).into();
assert_eq!(false, maybe.is_owned());

{
    let reference = maybe.to_mut();
    assert_eq!(&mut PseudoBigData(12), reference);
}
assert!(maybe.is_owned());

Trait Implementations§

§

impl<'min, L, R, OUT> Add<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Add<R, Output = OUT, Output = OUT> + Add<&'min R>, &'min L: Add<R, Output = OUT, Output = OUT> + Add<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the + operator.
§

fn add( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Add<MaybeOwned<'min, R>>>::Output

Performs the + operation. Read more
§

impl<'min, L, R> AddAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + AddAssign<R> + AddAssign<&'min R>,

§

fn add_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the += operation. Read more
§

impl<T> AsRef<T> for MaybeOwned<'_, T>

§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<'min, L, R, OUT> BitAnd<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: BitAnd<R, Output = OUT, Output = OUT> + BitAnd<&'min R>, &'min L: BitAnd<R, Output = OUT, Output = OUT> + BitAnd<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the & operator.
§

fn bitand( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as BitAnd<MaybeOwned<'min, R>>>::Output

Performs the & operation. Read more
§

impl<'min, L, R> BitAndAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + BitAndAssign<R> + BitAndAssign<&'min R>,

§

fn bitand_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the &= operation. Read more
§

impl<'min, L, R, OUT> BitOr<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: BitOr<R, Output = OUT, Output = OUT> + BitOr<&'min R>, &'min L: BitOr<R, Output = OUT, Output = OUT> + BitOr<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the | operator.
§

fn bitor( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as BitOr<MaybeOwned<'min, R>>>::Output

Performs the | operation. Read more
§

impl<'min, L, R> BitOrAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + BitOrAssign<R> + BitOrAssign<&'min R>,

§

fn bitor_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the |= operation. Read more
§

impl<'min, L, R, OUT> BitXor<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: BitXor<R, Output = OUT, Output = OUT> + BitXor<&'min R>, &'min L: BitXor<R, Output = OUT, Output = OUT> + BitXor<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the ^ operator.
§

fn bitxor( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as BitXor<MaybeOwned<'min, R>>>::Output

Performs the ^ operation. Read more
§

impl<'min, L, R> BitXorAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + BitXorAssign<R> + BitXorAssign<&'min R>,

§

fn bitxor_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the ^= operation. Read more
§

impl<T> Borrow<T> for MaybeOwned<'_, T>

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> Clone for MaybeOwned<'_, T>where T: Clone,

§

fn clone(&self) -> MaybeOwned<'_, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a, T> Debug for MaybeOwned<'a, T>where T: Debug + 'a,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Default for MaybeOwned<'_, T>where T: Default,

§

fn default() -> MaybeOwned<'_, T>

Returns the “default value” for a type. Read more
§

impl<T> Deref for MaybeOwned<'_, T>

§

type Target = T

The resulting type after dereferencing.
§

fn deref(&self) -> &T

Dereferences the value.
§

impl<'a, T> Display for MaybeOwned<'a, T>where T: Display,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'min, L, R, OUT> Div<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Div<R, Output = OUT, Output = OUT> + Div<&'min R>, &'min L: Div<R, Output = OUT, Output = OUT> + Div<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the / operator.
§

fn div( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Div<MaybeOwned<'min, R>>>::Output

Performs the / operation. Read more
§

impl<'min, L, R> DivAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + DivAssign<R> + DivAssign<&'min R>,

§

fn div_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the /= operation. Read more
§

impl<'a, T> From<&'a T> for MaybeOwned<'a, T>

§

fn from(v: &'a T) -> MaybeOwned<'a, T>

Converts to this type from the input type.
§

impl<'a, T> From<Cow<'a, T>> for MaybeOwned<'a, T>where T: ToOwned<Owned = T>,

§

fn from(cow: Cow<'a, T>) -> MaybeOwned<'a, T>

Converts to this type from the input type.
§

impl<T> From<T> for MaybeOwned<'_, T>

§

fn from(v: T) -> MaybeOwned<'_, T>

Converts to this type from the input type.
§

impl<T> FromStr for MaybeOwned<'_, T>where T: FromStr,

§

type Err = <T as FromStr>::Err

The associated error which can be returned from parsing.
§

fn from_str( s: &str ) -> Result<MaybeOwned<'_, T>, <MaybeOwned<'_, T> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl<T> Hash for MaybeOwned<'_, T>where T: Hash,

§

fn hash<H>(&self, state: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'a, T> Into<Cow<'a, T>> for MaybeOwned<'a, T>where T: ToOwned<Owned = T>,

§

fn into(self) -> Cow<'a, T>

Converts this type into the (usually inferred) input type.
§

impl<'min, L, R, OUT> Mul<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Mul<R, Output = OUT, Output = OUT> + Mul<&'min R>, &'min L: Mul<R, Output = OUT, Output = OUT> + Mul<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the * operator.
§

fn mul( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Mul<MaybeOwned<'min, R>>>::Output

Performs the * operation. Read more
§

impl<'min, L, R> MulAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + MulAssign<R> + MulAssign<&'min R>,

§

fn mul_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the *= operation. Read more
§

impl<'l, V, OUT> Neg for MaybeOwned<'l, V>where V: Neg<Output = OUT>, &'l V: Neg<Output = OUT>,

§

type Output = OUT

The resulting type after applying the - operator.
§

fn neg(self) -> <MaybeOwned<'l, V> as Neg>::Output

Performs the unary - operation. Read more
§

impl<'l, V, OUT> Not for MaybeOwned<'l, V>where V: Not<Output = OUT>, &'l V: Not<Output = OUT>,

§

type Output = <V as Not>::Output

The resulting type after applying the ! operator.
§

fn not(self) -> <MaybeOwned<'l, V> as Not>::Output

Performs the unary ! operation. Read more
§

impl<T> Ord for MaybeOwned<'_, T>where T: Ord,

§

fn cmp(&self, other: &MaybeOwned<'_, T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
§

impl<'b, A, B> PartialEq<MaybeOwned<'b, B>> for MaybeOwned<'_, A>where A: PartialEq<B>,

§

fn eq(&self, other: &MaybeOwned<'b, B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> PartialOrd for MaybeOwned<'_, T>where T: PartialOrd,

§

fn partial_cmp(&self, other: &MaybeOwned<'_, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<'min, L, R, OUT> Shl<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Shl<R, Output = OUT, Output = OUT> + Shl<&'min R>, &'min L: Shl<R, Output = OUT, Output = OUT> + Shl<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the << operator.
§

fn shl( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Shl<MaybeOwned<'min, R>>>::Output

Performs the << operation. Read more
§

impl<'min, L, R> ShlAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + ShlAssign<R> + ShlAssign<&'min R>,

§

fn shl_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the <<= operation. Read more
§

impl<'min, L, R, OUT> Shr<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Shr<R, Output = OUT, Output = OUT> + Shr<&'min R>, &'min L: Shr<R, Output = OUT, Output = OUT> + Shr<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the >> operator.
§

fn shr( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Shr<MaybeOwned<'min, R>>>::Output

Performs the >> operation. Read more
§

impl<'min, L, R> ShrAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + ShrAssign<R> + ShrAssign<&'min R>,

§

fn shr_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the >>= operation. Read more
§

impl<'min, L, R, OUT> Sub<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Sub<R, Output = OUT, Output = OUT> + Sub<&'min R>, &'min L: Sub<R, Output = OUT, Output = OUT> + Sub<&'min R>, OUT: 'min,

§

type Output = OUT

The resulting type after applying the - operator.
§

fn sub( self, rhs: MaybeOwned<'min, R> ) -> <MaybeOwned<'min, L> as Sub<MaybeOwned<'min, R>>>::Output

Performs the - operation. Read more
§

impl<'min, L, R> SubAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L>where L: Clone + SubAssign<R> + SubAssign<&'min R>,

§

fn sub_assign(&mut self, rhs: MaybeOwned<'min, R>)

Performs the -= operation. Read more
§

impl<'a, T> Eq for MaybeOwned<'a, T>where T: Eq,

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for MaybeOwned<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> Send for MaybeOwned<'a, T>where T: Send + Sync,

§

impl<'a, T> Sync for MaybeOwned<'a, T>where T: Sync,

§

impl<'a, T> Unpin for MaybeOwned<'a, T>where T: Unpin,

§

impl<'a, T> UnwindSafe for MaybeOwned<'a, T>where T: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<S, T> ParallelSlice<T> for Swhere T: Sync, S: AsRef<[T]>,

§

fn par_chunk_map<F, R>( &self, task_pool: &TaskPool, chunk_size: usize, f: F ) -> Vec<R>where F: Fn(&[T]) -> R + Send + Sync, R: Send + 'static,

Splits the slice in chunks of size chunks_size or less and maps the chunks in parallel across the provided task_pool. One task is spawned in the task pool for every chunk. Read more
§

fn par_splat_map<F, R>( &self, task_pool: &TaskPool, max_tasks: Option<usize>, f: F ) -> Vec<R>where F: Fn(&[T]) -> R + Send + Sync, R: Send + 'static,

Splits the slice into a maximum of max_tasks chunks, and maps the chunks in parallel across the provided task_pool. One task is spawned in the task pool for every chunk. Read more
§

impl<T> RawClone for Twhere T: Clone,

§

unsafe fn raw_clone(src: *const c_void, dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_clone_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDefault for Twhere T: Default,

§

unsafe fn raw_default(dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_default_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDrop for T

§

unsafe fn raw_drop(ptr: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_drop_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawEq for Twhere T: Eq,

§

unsafe fn raw_eq(a: *const c_void, b: *const c_void) -> bool

Get the hash of the type. Read more
§

fn raw_eq_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *const c_void) -> bool + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawHash for Twhere T: Hash,

§

unsafe fn raw_hash(ptr: *const c_void) -> u64

Get the hash of the type. Read more
§

fn raw_hash_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Send + Sync)>

Get a callback suitable for [SchemaData].
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more