Skip to main content

ToOwnedIn

Trait ToOwnedIn 

Source
pub trait ToOwnedIn<A: Allocator> {
    type Owned: Borrow<Self>;

    // Required method
    fn try_to_owned_in<I>(
        &self,
        alloc_in: I,
    ) -> Result<Self::Owned, StorageError>
       where I: AllocateIn<Alloc = A>;

    // Provided method
    fn to_owned_in<I>(&self, alloc_in: I) -> Self::Owned
       where I: AllocateIn<Alloc = A> { ... }
}
Expand description

Support conversion from borrowed types to owned ones associated with an allocator.

Required Associated Types§

Source

type Owned: Borrow<Self>

The owned representation of this type.

Required Methods§

Source

fn try_to_owned_in<I>(&self, alloc_in: I) -> Result<Self::Owned, StorageError>
where I: AllocateIn<Alloc = A>,

To to create an owned copy of this instance in a given allocation target.

Provided Methods§

Source

fn to_owned_in<I>(&self, alloc_in: I) -> Self::Owned
where I: AllocateIn<Alloc = A>,

Create an owned copy of this instance in a given allocation target.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Clone, A: Allocator> ToOwnedIn<A> for [T]

Source§

type Owned = Vec<T, A>

Source§

fn try_to_owned_in<I>(&self, alloc_in: I) -> Result<Self::Owned, StorageError>
where I: AllocateIn<Alloc = A>,

Implementors§

Source§

impl<T: Clone + 'static, A: Allocator> ToOwnedIn<A> for T

Source§

type Owned = T