pub trait AsIs: Sized + BorrowAsIs {
// Required method
fn as_is<'a>(self) -> Is<'a, Self::Is>
where Self: 'a;
// Provided methods
fn into_is<'a, B>(self) -> Is<'a, B>
where Self: 'a,
Self::Is: BorrowMut<B>,
B: ?Sized + ToOwned<Owned = Owned<Self>> { ... }
fn into_is_cow<'a, B>(self) -> IsCow<'a, B>
where Self: 'a,
Self::Is: Borrow<B>,
B: ?Sized + ToOwned<Owned = Owned<Self>> { ... }
fn try_into_is_mut<'a, B>(self) -> Result<IsMut<'a, B>, Is<'a, Self::Is>>
where Self: 'a,
Self::Is: BorrowMut<B>,
B: ?Sized + 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>(self) -> Cow<'a, B>
where Self: 'a,
Self::Is: Borrow<B>,
B: ?Sized + ToOwned<Owned = Owned<Self>> { ... }
}Expand description
Used to do a cheap conversion into Is<'a, T> in generic contexts.
Required Methods§
Sourcefn as_is<'a>(self) -> Is<'a, Self::Is>where
Self: 'a,
fn as_is<'a>(self) -> Is<'a, Self::Is>where
Self: 'a,
Converts self into an Is<'a, Self::Is>.
Provided Methods§
Sourcefn into_is_cow<'a, B>(self) -> IsCow<'a, B>
fn into_is_cow<'a, B>(self) -> IsCow<'a, B>
Converts self into an IsCow<'a, B>.
Sourcefn try_into_is_mut<'a, B>(self) -> Result<IsMut<'a, B>, Is<'a, Self::Is>>
fn try_into_is_mut<'a, B>(self) -> Result<IsMut<'a, B>, Is<'a, Self::Is>>
Converts self into an IsMut<'a, B> without cloning if possible.
§Errors
If self cannot be converted without cloning, returns self as Is<'a, Self::Is>.
Sourcefn try_into_owned<'a>(self) -> Result<Owned<Self>, Is<'a, Self::Is>>where
Self: 'a,
fn try_into_owned<'a>(self) -> Result<Owned<Self>, Is<'a, Self::Is>>where
Self: 'a,
Converts self into an owned data without cloning if possible.
§Errors
If self cannot be converted without cloning, returns self as Is<'a, Self::Is>.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.