[][src]Enum abin::Boo

pub enum Boo<'a, TBorrowed, TOwned> where
    TBorrowed: ?Sized
{ Borrowed(&'a TBorrowed), Owned(TOwned), }

A borrowed-or-owned type (boo).

Similar to std::borrow::Cow but without the requirement of TBorrowed : ToOwned<Owned=TOwned>.

Variants

Borrowed(&'a TBorrowed)

It's borrowed.

Owned(TOwned)

It's owned.

Implementations

impl<'a, TBorrowed, TOwned> Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: ?Sized
[src]

pub fn into_owned_with<TBooToOwned>(self) -> TOwned where
    TBooToOwned: BooToOwned<TBorrowed, TOwned>, 
[src]

Returns self if already owned. If borrowed, converts the value to owned using TBooToOwned.

impl<'a, TBorrowed, TOwned> Boo<'a, TBorrowed, TOwned> where
    TBorrowed: ToOwned<Owned = TOwned>,
    TOwned: Borrow<TBorrowed>,
    TBorrowed: ?Sized
[src]

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

Trait Implementations

impl<'a, TBorrowed, TOwned> AsRef<TBorrowed> for Boo<'a, TBorrowed, TOwned> where
    TOwned: AsRef<TBorrowed>,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Borrow<TBorrowed> for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Clone for Boo<'a, TBorrowed, TOwned> where
    TOwned: Clone,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned: Debug> Debug for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: Debug + ?Sized
[src]

impl<'a, TBorrowed, TOwned> Default for Boo<'a, TBorrowed, TOwned> where
    TOwned: Default,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Deref for Boo<'a, TBorrowed, TOwned> where
    TOwned: Deref<Target = TBorrowed>,
    TBorrowed: ?Sized
[src]

type Target = TBorrowed

The resulting type after dereferencing.

impl<'a, TBorrowed, TOwned> Display for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: Display,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Eq for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: Eq + PartialEq,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> From<&'a TBorrowed> for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Hash for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: Hash,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> Ord for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: Ord + Eq + PartialOrd,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> PartialEq<Boo<'a, TBorrowed, TOwned>> for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: PartialEq,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> PartialEq<TBorrowed> for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: PartialEq,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> PartialOrd<Boo<'a, TBorrowed, TOwned>> for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: PartialOrd + PartialEq,
    TBorrowed: ?Sized
[src]

impl<'a, TBorrowed, TOwned> PartialOrd<TBorrowed> for Boo<'a, TBorrowed, TOwned> where
    TOwned: Borrow<TBorrowed>,
    TBorrowed: PartialOrd + PartialEq,
    TBorrowed: ?Sized
[src]

Auto Trait Implementations

impl<'a, TBorrowed: ?Sized, TOwned> RefUnwindSafe for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: RefUnwindSafe,
    TOwned: RefUnwindSafe

impl<'a, TBorrowed: ?Sized, TOwned> Send for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: Sync,
    TOwned: Send

impl<'a, TBorrowed: ?Sized, TOwned> Sync for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: Sync,
    TOwned: Sync

impl<'a, TBorrowed: ?Sized, TOwned> Unpin for Boo<'a, TBorrowed, TOwned> where
    TOwned: Unpin

impl<'a, TBorrowed: ?Sized, TOwned> UnwindSafe for Boo<'a, TBorrowed, TOwned> where
    TBorrowed: RefUnwindSafe,
    TOwned: UnwindSafe

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.