emplace_init

Trait Emplace

Source
pub unsafe trait Emplace<Args>: Sized {
    // Required method
    unsafe fn emplace(place: Pin<&mut MaybeUninit<Self>>, args: Args);
}
Expand description

A type that can be constructed in-place.

This trait is unsafe to implement due to the constraints on emplace.

Required Methods§

Source

unsafe fn emplace(place: Pin<&mut MaybeUninit<Self>>, args: Args)

Initializes place with a valid value of Self using the given arguments.

§Safety (implementer)

The implementor must initialize place. Callers are allowed to assume that place is initialized after this returns.

§Safety (caller)

This function is safe to call only when place is uninitialized. Otherwise, it could be used to move out of a pinned value.

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.

Implementors§