[−][src]Enum xref::XRef
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>)
Implementations
impl<'a, T> XRef<'a, T>
[src]
impl<'a, T: Clone> XRef<'a, T>
[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> Clone for XRef<'a, T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: Debug> Debug for XRef<'a, T>
[src]
impl<'a, T: Default> Default for XRef<'a, T>
[src]
impl<'a, T> Deref for XRef<'a, T>
[src]
impl<'a, T: Display> Display for XRef<'a, T>
[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,
T: Unpin,
impl<'a, T> !UnwindSafe for XRef<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,