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§
Sourcefn emplace<Init: EmplaceInitializer<Output = Self::Output>>(init: Init) -> Self
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.