Struct static_init::Lazy

source ·
pub struct Lazy<T, F = fn() -> T> { /* private fields */ }
Expand description

The type of lesser lazy statics.

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

Implementations§

Initialize a lazy with a builder as argument.

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 without optimization check

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.

Drop the contained value

Safety

The value should not be accessed any more.

Trait Implementations§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably 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.