Enum maybe_owned::MaybeOwned [−][src]
pub enum MaybeOwned<'a, T: 'a> { Owned(T), Borrowed(&'a T), }
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::Onwed
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
implNeg
&V
implNeg
- both have the same
Output
The Not
(!
prefix) op is implemented for V
if:
V
implNot
&V
implNot
- 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
Methods
impl<'a, T> MaybeOwned<'a, T>
[src]
impl<'a, T> MaybeOwned<'a, T>
impl<'a, T> MaybeOwned<'a, T> where
T: Clone,
[src]
impl<'a, T> MaybeOwned<'a, T> where
T: Clone,
pub fn to_mut(&mut self) -> &mut T
[src]
pub fn to_mut(&mut self) -> &mut T
Aquires 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());
pub fn into_owned(self) -> T
[src]
pub fn into_owned(self) -> T
Extracts the owned data.
If the data is borrowed it is cloned before being extracted.
Trait Implementations
impl<'min, L, R, OUT: 'min> Add<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Add<R, Output = OUT> + Add<&'min R, Output = OUT>,
&'min L: Add<R, Output = OUT> + Add<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Add<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Add<R, Output = OUT> + Add<&'min R, Output = OUT>,
&'min L: Add<R, Output = OUT> + Add<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the +
operator.
fn add(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn add(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the +
operation.
impl<'min, L, R> AddAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + AddAssign<R> + AddAssign<&'min R>,
[src]
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>)
[src]
fn add_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the +=
operation.
impl<'min, L, R, OUT: 'min> Sub<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Sub<R, Output = OUT> + Sub<&'min R, Output = OUT>,
&'min L: Sub<R, Output = OUT> + Sub<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Sub<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Sub<R, Output = OUT> + Sub<&'min R, Output = OUT>,
&'min L: Sub<R, Output = OUT> + Sub<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the -
operator.
fn sub(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn sub(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the -
operation.
impl<'min, L, R> SubAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + SubAssign<R> + SubAssign<&'min R>,
[src]
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>)
[src]
fn sub_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the -=
operation.
impl<'min, L, R, OUT: 'min> Mul<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Mul<R, Output = OUT> + Mul<&'min R, Output = OUT>,
&'min L: Mul<R, Output = OUT> + Mul<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Mul<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Mul<R, Output = OUT> + Mul<&'min R, Output = OUT>,
&'min L: Mul<R, Output = OUT> + Mul<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the *
operator.
fn mul(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn mul(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the *
operation.
impl<'min, L, R> MulAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + MulAssign<R> + MulAssign<&'min R>,
[src]
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>)
[src]
fn mul_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the *=
operation.
impl<'min, L, R, OUT: 'min> Div<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Div<R, Output = OUT> + Div<&'min R, Output = OUT>,
&'min L: Div<R, Output = OUT> + Div<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Div<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Div<R, Output = OUT> + Div<&'min R, Output = OUT>,
&'min L: Div<R, Output = OUT> + Div<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the /
operator.
fn div(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn div(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the /
operation.
impl<'min, L, R> DivAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + DivAssign<R> + DivAssign<&'min R>,
[src]
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>)
[src]
fn div_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the /=
operation.
impl<'min, L, R, OUT: 'min> Shl<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Shl<R, Output = OUT> + Shl<&'min R, Output = OUT>,
&'min L: Shl<R, Output = OUT> + Shl<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Shl<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Shl<R, Output = OUT> + Shl<&'min R, Output = OUT>,
&'min L: Shl<R, Output = OUT> + Shl<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the <<
operator.
fn shl(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn shl(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the <<
operation.
impl<'min, L, R> ShlAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + ShlAssign<R> + ShlAssign<&'min R>,
[src]
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>)
[src]
fn shl_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the <<=
operation.
impl<'min, L, R, OUT: 'min> Shr<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Shr<R, Output = OUT> + Shr<&'min R, Output = OUT>,
&'min L: Shr<R, Output = OUT> + Shr<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> Shr<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Shr<R, Output = OUT> + Shr<&'min R, Output = OUT>,
&'min L: Shr<R, Output = OUT> + Shr<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the >>
operator.
fn shr(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn shr(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the >>
operation.
impl<'min, L, R> ShrAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + ShrAssign<R> + ShrAssign<&'min R>,
[src]
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>)
[src]
fn shr_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the >>=
operation.
impl<'min, L, R, OUT: 'min> BitAnd<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitAnd<R, Output = OUT> + BitAnd<&'min R, Output = OUT>,
&'min L: BitAnd<R, Output = OUT> + BitAnd<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> BitAnd<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitAnd<R, Output = OUT> + BitAnd<&'min R, Output = OUT>,
&'min L: BitAnd<R, Output = OUT> + BitAnd<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the &
operator.
fn bitand(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn bitand(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the &
operation.
impl<'min, L, R> BitAndAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + BitAndAssign<R> + BitAndAssign<&'min R>,
[src]
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>)
[src]
fn bitand_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the &=
operation.
impl<'min, L, R, OUT: 'min> BitOr<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitOr<R, Output = OUT> + BitOr<&'min R, Output = OUT>,
&'min L: BitOr<R, Output = OUT> + BitOr<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> BitOr<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitOr<R, Output = OUT> + BitOr<&'min R, Output = OUT>,
&'min L: BitOr<R, Output = OUT> + BitOr<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the |
operator.
fn bitor(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn bitor(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the |
operation.
impl<'min, L, R> BitOrAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + BitOrAssign<R> + BitOrAssign<&'min R>,
[src]
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>)
[src]
fn bitor_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the |=
operation.
impl<'min, L, R, OUT: 'min> BitXor<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitXor<R, Output = OUT> + BitXor<&'min R, Output = OUT>,
&'min L: BitXor<R, Output = OUT> + BitXor<&'min R, Output = OUT>,
[src]
impl<'min, L, R, OUT: 'min> BitXor<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: BitXor<R, Output = OUT> + BitXor<&'min R, Output = OUT>,
&'min L: BitXor<R, Output = OUT> + BitXor<&'min R, Output = OUT>,
type Output = OUT
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: MaybeOwned<'min, R>) -> Self::Output
[src]
fn bitxor(self, rhs: MaybeOwned<'min, R>) -> Self::Output
Performs the ^
operation.
impl<'min, L, R> BitXorAssign<MaybeOwned<'min, R>> for MaybeOwned<'min, L> where
L: Clone + BitXorAssign<R> + BitXorAssign<&'min R>,
[src]
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>)
[src]
fn bitxor_assign(&mut self, rhs: MaybeOwned<'min, R>)
Performs the ^=
operation.
impl<'l, V, OUT> Neg for MaybeOwned<'l, V> where
V: Neg<Output = OUT>,
&'l V: Neg<Output = OUT>,
[src]
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) -> Self::Output
[src]
fn neg(self) -> Self::Output
Performs the unary -
operation.
impl<'l, V, OUT> Not for MaybeOwned<'l, V> where
V: Not<Output = OUT>,
&'l V: Not<Output = OUT>,
[src]
impl<'l, V, OUT> Not for MaybeOwned<'l, V> where
V: Not<Output = OUT>,
&'l V: Not<Output = OUT>,
type Output = V::Output
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
fn not(self) -> Self::Output
Performs the unary !
operation.
impl<'a, T: Debug + 'a> Debug for MaybeOwned<'a, T>
[src]
impl<'a, T: Debug + 'a> Debug for MaybeOwned<'a, T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, T> Deref for MaybeOwned<'a, T>
[src]
impl<'a, T> Deref for MaybeOwned<'a, T>
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
fn deref(&self) -> &T
Dereferences the value.
impl<'a, T> AsRef<T> for MaybeOwned<'a, T>
[src]
impl<'a, T> AsRef<T> for MaybeOwned<'a, T>
impl<'a, T> Borrow<T> for MaybeOwned<'a, T>
[src]
impl<'a, T> Borrow<T> for MaybeOwned<'a, T>
impl<'a, T> From<&'a T> for MaybeOwned<'a, T>
[src]
impl<'a, T> From<&'a T> for MaybeOwned<'a, T>
fn from(v: &'a T) -> MaybeOwned<'a, T>
[src]
fn from(v: &'a T) -> MaybeOwned<'a, T>
Performs the conversion.
impl<'a, T> From<T> for MaybeOwned<'a, T>
[src]
impl<'a, T> From<T> for MaybeOwned<'a, T>
fn from(v: T) -> MaybeOwned<'a, T>
[src]
fn from(v: T) -> MaybeOwned<'a, T>
Performs the conversion.
impl<'a, T> From<Cow<'a, T>> for MaybeOwned<'a, T> where
T: ToOwned<Owned = T>,
[src]
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>
[src]
fn from(cow: Cow<'a, T>) -> MaybeOwned<'a, T>
Performs the conversion.
impl<'a, T> Into<Cow<'a, T>> for MaybeOwned<'a, T> where
T: ToOwned<Owned = T>,
[src]
impl<'a, T> Into<Cow<'a, T>> for MaybeOwned<'a, T> where
T: ToOwned<Owned = T>,
impl<'a, T> Default for MaybeOwned<'a, T> where
T: Default,
[src]
impl<'a, T> Default for MaybeOwned<'a, T> where
T: Default,
impl<'a, T> Clone for MaybeOwned<'a, T> where
T: Clone,
[src]
impl<'a, T> Clone for MaybeOwned<'a, T> where
T: Clone,
fn clone(&self) -> MaybeOwned<'a, T>
[src]
fn clone(&self) -> MaybeOwned<'a, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a, 'b, A, B> PartialEq<MaybeOwned<'b, B>> for MaybeOwned<'a, A> where
A: PartialEq<B>,
[src]
impl<'a, 'b, A, B> PartialEq<MaybeOwned<'b, B>> for MaybeOwned<'a, A> where
A: PartialEq<B>,
fn eq(&self, other: &MaybeOwned<'b, B>) -> bool
[src]
fn eq(&self, other: &MaybeOwned<'b, B>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a, T> Eq for MaybeOwned<'a, T> where
T: Eq,
[src]
impl<'a, T> Eq for MaybeOwned<'a, T> where
T: Eq,
impl<'a, T> PartialOrd for MaybeOwned<'a, T> where
T: PartialOrd,
[src]
impl<'a, T> PartialOrd for MaybeOwned<'a, T> where
T: PartialOrd,
fn partial_cmp(&self, other: &MaybeOwned<'a, T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &MaybeOwned<'a, T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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<'a, T> Ord for MaybeOwned<'a, T> where
T: Ord,
[src]
impl<'a, T> Ord for MaybeOwned<'a, T> where
T: Ord,
fn cmp(&self, other: &MaybeOwned<'a, T>) -> Ordering
[src]
fn cmp(&self, other: &MaybeOwned<'a, T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<'a, T> Hash for MaybeOwned<'a, T> where
T: Hash,
[src]
impl<'a, T> Hash for MaybeOwned<'a, T> where
T: Hash,
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a, T> Display for MaybeOwned<'a, T> where
T: Display,
[src]
impl<'a, T> Display for MaybeOwned<'a, T> where
T: Display,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, T> FromStr for MaybeOwned<'a, T> where
T: FromStr,
[src]
impl<'a, T> FromStr for MaybeOwned<'a, T> where
T: FromStr,
Auto Trait Implementations
impl<'a, T> Send for MaybeOwned<'a, T> where
T: Send + Sync,
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> Sync for MaybeOwned<'a, T> where
T: Sync,