Enum core::borrow::CowUnstable [-]  [+] [src]

pub enum Cow<'a, T, B: 'a> where B: ToOwned<T> {
    Borrowed(&'a B),
    Owned(T),
}

A clone-on-write smart pointer.

Variants

Borrowed

Borrowed data.

Owned

Owned data.

Methods

impl<'a, T, B> Cow<'a, T, B> where B: ToOwned<T>

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

Acquire a mutable reference to the owned form of the data.

Copies the data if it is not already owned.

fn into_owned(self) -> T

Extract the owned data.

Copies the data if it is not already owned.

Trait Implementations

impl<'a, T, B> Deref<B> for Cow<'a, T, B> where B: ToOwned<T>

fn deref(&self) -> &B