pub struct StaticUninitializedBuffer<T: 'static> { /* private fields */ }
Expand description

The StaticUninitializedBuffer type represents a statically allocated buffer that can be converted to another type once it has been initialized. Upon initialization, a static mutable reference is returned and the StaticUninitializedBuffer is consumed.

This type is implemented as a wrapper containing a static mutable reference to an UninitializedBuffer. This guarantees that the memory pointed to by the reference has not already been initialized.

StaticUninitializedBuffer provides one operation: initialize() that returns a &'static mut T reference. This is the only way to get the reference, and ensures that the underlying uninitialized buffer is properly initialized. The wrapper is also consumed when initialize() is called, ensuring that the underlying memory cannot be subsequently re-initialized.

Implementations

This function is not intended to be called publicly. It’s only meant to be called within static_buf! macro, but Rust’s visibility rules require it to be public, so that the macro’s body can be instantiated.

This function consumes an uninitialized static buffer, initializes it to some value, and returns a static mutable reference to it. This allows for runtime initialization of static values that do not have a const constructor.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.