Skip to main content

TryToOwned

Trait TryToOwned 

pub trait TryToOwned {
    type Owned: Borrow<Self>;

    // Required method
    fn try_to_owned(&self) -> Result<Self::Owned, OutOfMemory>;
}
Expand description

Like std::borrow::ToOwned but returns an OutOfMemory error on allocation failure.

Required Associated Types§

type Owned: Borrow<Self>

The owned version of this type.

Required Methods§

fn try_to_owned(&self) -> Result<Self::Owned, OutOfMemory>

Try to allocate an owned version of self.

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.

Implementations on Foreign Types§

§

impl TryToOwned for str

§

impl<T> TryToOwned for [T]
where T: TryClone,

Implementors§

§

impl<T> TryToOwned for T
where T: TryClone,

§

type Owned = T