pub trait AsIs: Sized + Borrow<Self::Is> {
    type Is: ?Sized + ToOwned;

    fn as_is<'a>(self) -> Is<'a, Self::Is>
    where
        Self: 'a
; fn borrow_or_clone<B: ?Sized>(&self) -> IsCow<'_, B>
    where
        Self::Is: Borrow<B>,
        Owned<Self>: Borrow<B>,
        B: ToOwned<Owned = Owned<Self>>
, { ... } fn into_is<'a, B: ?Sized>(self) -> Is<'a, B>
    where
        Self: 'a,
        Self::Is: BorrowMut<B>,
        B: ToOwned<Owned = Owned<Self>>
, { ... } fn into_is_cow<'a, B: ?Sized>(self) -> IsCow<'a, B>
    where
        Self: 'a,
        Self::Is: Borrow<B>,
        B: ToOwned<Owned = Owned<Self>>
, { ... } fn try_into_is_mut<'a, B: ?Sized>(
        self
    ) -> Result<IsMut<'a, B>, Is<'a, Self::Is>>
    where
        Self: 'a,
        Self::Is: BorrowMut<B>,
        B: ToOwned<Owned = Owned<Self>>
, { ... } fn try_into_owned<'a>(self) -> Result<Owned<Self>, Is<'a, Self::Is>>
    where
        Self: 'a
, { ... } fn into_cow<'a, B: ?Sized>(self) -> Cow<'a, B>
    where
        Self: 'a,
        Self::Is: Borrow<B>,
        B: ToOwned<Owned = Owned<Self>> + ToOwned<Owned = Owned<Self>>
, { ... } }
Expand description

Used to do a cheap conversion into Is<'a, T> in a generic context.

Required Associated Types

The base type associated with both owned and borrowed data.

Required Methods

Converts self into an Is<'a, Self::Is>.

Provided Methods

Immutably borrows from self by default, but can be overridden to clone self if appropriate.

Converts self into an Is<'a, B>.

Converts self into an IsCow<'a, B>.

Converts self into an IsMut<'a, B> without cloning if possible.

Errors

If self cannot be converted without cloning, returns self as is.

Converts self into an owned data without cloning if possible.

Errors

If self cannot be converted without cloning, returns self as is.

Converts self into a Cow<'a, B>. Only available if the alloc feature is enabled.

Implementations on Foreign Types

Implementors