Enum mucow::MuCow
[−]
[src]
pub enum MuCow<'a, B: ?Sized + 'a> where
B: ToOwned, { Borrowed(&'a mut B), Owned(<B as ToOwned>::Owned), }
A clone-on-consume smart pointer.
Variants
Borrowed(&'a mut B)
Borrowed data.
Owned(<B as ToOwned>::Owned)
Owned data.
Methods
impl<'a, B: ?Sized> MuCow<'a, B> where
B: ToOwned,
[src]
B: ToOwned,
fn into_owned(self) -> <B as ToOwned>::Owned
Extracts the owned data.
Clones the data if it is not already owned.
Trait Implementations
impl<'a, B: ?Sized> Borrow<B> for MuCow<'a, B> where
B: ToOwned,
B::Owned: 'a,
[src]
B: ToOwned,
B::Owned: 'a,
impl<'a, B: ?Sized> BorrowMut<B> for MuCow<'a, B> where
B: ToOwned,
B::Owned: 'a + BorrowMut<B>,
[src]
B: ToOwned,
B::Owned: 'a + BorrowMut<B>,
fn borrow_mut(&mut self) -> &mut B
Mutably borrows from an owned value. Read more
impl<'a, B: ?Sized> Into<Cow<'a, B>> for MuCow<'a, B> where
B: ToOwned,
[src]
B: ToOwned,
impl<'a, B: ?Sized> Clone for MuCow<'a, B> where
B: ToOwned,
[src]
B: ToOwned,
fn clone(&self) -> MuCow<'a, B>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, B: ?Sized> Deref for MuCow<'a, B> where
B: ToOwned,
[src]
B: ToOwned,
type Target = B
The resulting type after dereferencing
fn deref(&self) -> &B
The method called to dereference a value
impl<'a, B: ?Sized> DerefMut for MuCow<'a, B> where
B: ToOwned,
B::Owned: BorrowMut<B>,
[src]
B: ToOwned,
B::Owned: BorrowMut<B>,
fn deref_mut(&mut self) -> &mut B
The method called to mutably dereference a value
impl<'a, B: ?Sized> Eq for MuCow<'a, B> where
B: Eq + ToOwned,
[src]
B: Eq + ToOwned,
impl<'a, B: ?Sized> Ord for MuCow<'a, B> where
B: Ord + ToOwned,
[src]
B: Ord + ToOwned,
fn cmp(&self, other: &MuCow<'a, B>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<'a, 'b, B: ?Sized, C: ?Sized> PartialEq<MuCow<'b, C>> for MuCow<'a, B> where
B: PartialEq<C> + ToOwned,
C: ToOwned,
[src]
B: PartialEq<C> + ToOwned,
C: ToOwned,
fn eq(&self, other: &MuCow<'b, C>) -> 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
This method tests for !=
.
impl<'a, B: ?Sized> PartialOrd for MuCow<'a, B> where
B: PartialOrd + ToOwned,
[src]
B: PartialOrd + ToOwned,
fn partial_cmp(&self, other: &MuCow<'a, B>) -> 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
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
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
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
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, B: ?Sized> Debug for MuCow<'a, B> where
B: Debug + ToOwned,
<B as ToOwned>::Owned: Debug,
[src]
B: Debug + ToOwned,
<B as ToOwned>::Owned: Debug,
impl<'a, B: ?Sized> Display for MuCow<'a, B> where
B: Display + ToOwned,
<B as ToOwned>::Owned: Display,
[src]
B: Display + ToOwned,
<B as ToOwned>::Owned: Display,
impl<'a, B: ?Sized> Default for MuCow<'a, B> where
B: ToOwned,
<B as ToOwned>::Owned: Default,
[src]
B: ToOwned,
<B as ToOwned>::Owned: Default,
impl<'a, B: ?Sized> Hash for MuCow<'a, B> where
B: Hash + ToOwned,
[src]
B: Hash + ToOwned,
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
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a, T: ?Sized + ToOwned> AsRef<T> for MuCow<'a, T>
[src]
fn as_ref(&self) -> &T
Performs the conversion.