Trait 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.

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§

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.

Source§

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.

Source§

type Output = T

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.

Source§

type Output = T

Implementors§