Enum bow::Bow
[−]
[src]
pub enum Bow<'a, T: 'a + ToBox + ?Sized> { Borrowed(&'a T), Boxed(Box<T>), }
Like a Cow
, using ToBox
instead of ToBoxed
.
Variants
Borrowed(&'a T)
Borrowed data.
Boxed(Box<T>)
Boxed data.
Methods
impl<'a, T: 'a + ToBox + ?Sized> Bow<'a, T>
[src]
fn to_mut(&mut self) -> &mut T
Acquires a mutable reference to the data.
Boxes the data if it is not already boxed.
fn into_box(self) -> Box<T>
Extracts the data as a box.
Boxes the data if it is not already boxed.
Trait Implementations
impl<'a, T: ToBox + ?Sized> Clone for Bow<'a, T>
[src]
fn clone(&self) -> Self
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, T: 'a + ToBox + ?Sized> Deref for Bow<'a, T>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<'a, T: 'a + ToBox + Debug + ?Sized> Debug for Bow<'a, T>
[src]
impl<'a, T: 'a + ToBox + Display + ?Sized> Display for Bow<'a, T>
[src]
impl<T: 'static + ToBox + ?Sized> Default for Bow<'static, T> where &'static T: Default
[src]
impl<'a, T: 'a + ToBox + ?Sized> AsRef<T> for Bow<'a, T>
[src]
fn as_ref(&self) -> &T
Performs the conversion.