Trait dst_init::BoxExt

source ·
pub trait BoxExt: Sized {
    type Output: ?Sized;

    // Required method
    fn emplace<Init: EmplaceInitializer<Output = Self::Output>>(
        init: Init
    ) -> Self;
}
Expand description

Abstract for type Box,Rc and etc to allocate value by EmplaceInitializer types.

Required Associated Types§

Required Methods§

source

fn emplace<Init: EmplaceInitializer<Output = Self::Output>>(init: Init) -> Self

Allocate memory by std::alloc::alloc() and emplace value in it Then use Self wrap it.

Implementations on Foreign Types§

source§

impl<T: ?Sized> BoxExt for Arc<T>

source§

fn emplace<Init: EmplaceInitializer<Output = Self::Output>>( init: Init ) -> Arc<Self::Output>

Allocate memory by std::alloc::alloc() and emplace value in it Then use Arc wrap it.

§

type Output = T

source§

impl<T: ?Sized> BoxExt for Rc<T>

source§

fn emplace<Init: EmplaceInitializer<Output = Self::Output>>( init: Init ) -> Rc<Self::Output>

Allocate memory by std::alloc::alloc() and emplace value in it Then use Rc wrap it.

§

type Output = T

source§

impl<T: ?Sized> BoxExt for Box<T>

source§

fn emplace<Init: EmplaceInitializer<Output = Self::Output>>( init: Init ) -> Box<Self::Output>

Allocate memory by std::alloc::alloc() and emplace value in it Then use Box wrap it.

§

type Output = T

Implementors§