[][src]Enum mtots_core::XRef

pub enum XRef<'a, T> {
    Borrowed(&'a T),
    Ref(Ref<'a, T>),
    Owned(T),
}

Kind of like Cow, but might also be a Ref (from a RefCell) Also, does not use ToOwned. This is because the main point of an XRef is not to Copy On Write, but to either hold an owned value or a reference to a value

Variants

Borrowed(&'a T)
Ref(Ref<'a, T>)
Owned(T)

Implementations

impl<'a, T> XRef<'a, T>[src]

pub fn to_ref(&self) -> &T[src]

impl<'a, T> XRef<'a, T> where
    T: Clone
[src]

pub fn to_mut(&mut self) -> &mut T[src]

Acquires a mutable reference to the owned form of the data. Clones the data if it is not already owned.

pub fn into_owned(self) -> T[src]

Extracts the owned data. Clones the data if it is not already owned.

Trait Implementations

impl<'a, T> AsRef<T> for XRef<'a, T>[src]

impl<'a, T> Borrow<T> for XRef<'a, T>[src]

impl<'a, T> Clone for XRef<'a, T> where
    T: Clone
[src]

impl<'a, T> Debug for XRef<'a, T> where
    T: Debug
[src]

impl<'a, T> Default for XRef<'a, T> where
    T: Default
[src]

impl<'a, T> Deref for XRef<'a, T>[src]

type Target = T

The resulting type after dereferencing.

impl<'a, T> Display for XRef<'a, T> where
    T: Display
[src]

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for XRef<'a, T>

impl<'a, T> !Send for XRef<'a, T>

impl<'a, T> !Sync for XRef<'a, T>

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

impl<'a, T> !UnwindSafe for XRef<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.