MemConstructConstructor

Trait MemConstructConstructor 

Source
pub unsafe trait MemConstructConstructor {
    type Target;

    // Required method
    unsafe fn new(ptr: *mut Self::Target) -> Self;
}
Expand description

A type used to construct a heap constructable object.

This trait is unsafe to implement and shouldn’t be manually implemented. A safe implementation of this is generated when you derive MemConstruct for your type.

§Implementation for Structs:

For normal structs a set function is generated for every field, each of these set functions has to be called exactly once, this is checked via typestate.

§Implementation for ZSTs:

For ZSTs the generated constructor has no functions and is always “ready”. The construct functions will still be called for ZSTs.

Required Associated Types§

Required Methods§

Source

unsafe fn new(ptr: *mut Self::Target) -> Self

Create a new MemConstructConstructor

§Safety

The pointer has to be a valid, non dangling pointer. The pointer must be well aligned and non null if not documented otherwise.

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§