Enum TempCow

Source
pub enum TempCow<T: ?Sized + ToOwned> {
    Borrowed(TempRef<T>),
    Owned(T::Owned),
}
Expand description

A temporary representation of alloc::borrow::Cow.

Variants§

§

Borrowed(TempRef<T>)

§

Owned(T::Owned)

Trait Implementations§

Source§

impl<T: ?Sized + ToOwned<Owned: Clone>> TempRepr for TempCow<T>

Source§

type Shared<'a> = Cow<'a, T> where Self: 'a

The type that Self is a temporary representation of. May contain shared references of lifetime 'a.
Source§

unsafe fn new_temp(obj: Self::Shared<'_>) -> Self

Converts the given object to its temporary representation. Read more
Source§

fn get(&self) -> Self::Shared<'_>

Converts from a shared temporary reference back to the original type with a suitably-restricted lifetime.
Source§

impl<T: ?Sized + ToOwned<Owned: Clone>> TempReprMutChk for TempCow<T>

Source§

type SwapChkData = Option<NonNull<T>>

Source§

fn swap_chk_data(&self) -> Self::SwapChkData

Obtains an object (usually a copy of the internal state of self) that can be used to check whether self was swapped with another instance of Self in such a way that the safety rules of TempReprMutChk are violated.
Source§

impl<T: ?Sized + ToOwned<Owned: Clone>> AlwaysShared for TempCow<T>

Auto Trait Implementations§

§

impl<T> Freeze for TempCow<T>
where <T as ToOwned>::Owned: Freeze, T: ?Sized,

§

impl<T> RefUnwindSafe for TempCow<T>

§

impl<T> Send for TempCow<T>
where <T as ToOwned>::Owned: Send, T: Sync + ?Sized,

§

impl<T> Sync for TempCow<T>
where <T as ToOwned>::Owned: Sync, T: Sync + ?Sized,

§

impl<T> Unpin for TempCow<T>
where <T as ToOwned>::Owned: Unpin, T: ?Sized,

§

impl<T> UnwindSafe for TempCow<T>
where <T as ToOwned>::Owned: UnwindSafe, T: RefUnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> TempReprMut for T
where T: AlwaysShared,

Source§

type Mutable<'a> = <T as TempRepr>::Shared<'a> where T: 'a

The type that Self is a temporary representation of. May contain mutable references of lifetime 'a.
Source§

unsafe fn new_temp_mut(obj: <T as TempReprMut>::Mutable<'_>) -> T

Converts the given object to a temporary representation without a lifetime parameter. Read more
Source§

fn get_mut(&mut self) -> <T as TempReprMut>::Mutable<'_>

Converts from a mutable reference to the temporary representation back to the original type, with a restricted lifetime.
Source§

fn get_mut_pinned(self: Pin<&mut T>) -> <T as TempReprMut>::Mutable<'_>

Like TempReprMut::get_mut, but takes a pinned mutable reference to Self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.