Struct static_init::ConstLazy

source ·
pub struct ConstLazy<T, F = fn() -> T>(_);
Expand description

The type of const lesser lazy statics.

Statics that are initialized on first access or before main is called.

They are declared mut when the lazy is drop so that the compiler inform the coder that access to those statics are unsafe: during program destruction (after main exit) the state may be invalid.

Implementations§

Initialize a lazy with a builder as argument.

Safety

This variable shall not be used as a thread_local statics or within the state of a thread_local static

Return a pointer to the value.

The value may be in an uninitialized state.

Ensure the value is initialized without optimization check

This is intended to be used at program start up by the dynamic macro.

Ensure the value is initialized

Once this function is called, it is guaranteed that the value is in an initialized state.

This function is always called when the lazy is dereferenced.

Trait Implementations§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.

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.