Enum boow::Bow [] [src]

pub enum Bow<'a, T: 'a> {
    Owned(T),
    Borrowed(&'a T),
}

Borrow-Or-oWned smart pointer.

[Bow] implements [Deref], which means that you can call non-mutating methods directly on the data it encloses. If mutation is desired, borrow_mut will obtain some mutable reference to an owned value, but only if it is owned.

Variants

Methods

impl<'a, T: 'a> Bow<'a, T>
[src]

[src]

Get a mutable reference to the enclosed value. Return [None] if the value is not owned.

[src]

Consume the enclosed value and return it if it is owned.

Trait Implementations

impl<'a, T: Copy + 'a> Copy for Bow<'a, T>
[src]

impl<'a, T: Clone + 'a> Clone for Bow<'a, T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Immutably borrows from an owned value. Read more

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

The resulting type after dereferencing.

[src]

Dereferences the value.

impl<'a, T: 'a> Eq for Bow<'a, T> where
    T: Eq
[src]

impl<'a, T: 'a> Ord for Bow<'a, T> where
    T: Ord
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<'a, T: 'a> PartialEq for Bow<'a, T> where
    T: PartialEq
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<'a, T: 'a> PartialOrd for Bow<'a, T> where
    T: PartialOrd
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

[src]

Formats the value using the given formatter. Read more

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

[src]

Formats the value using the given formatter. Read more

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

[src]

Returns the "default value" for a type. Read more

impl<'a, T: 'a> Hash for Bow<'a, T> where
    T: Hash
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

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

[src]

Performs the conversion.

Auto Trait Implementations

impl<'a, T> Send for Bow<'a, T> where
    T: Send + Sync

impl<'a, T> Sync for Bow<'a, T> where
    T: Sync