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§
source§impl<T, F> Lazy<T, F>
impl<T, F> Lazy<T, F>
sourcepub const fn as_mut_ptr(this: &Self) -> *mut T
pub const fn as_mut_ptr(this: &Self) -> *mut T
Return a pointer to the value.
The value may be in an uninitialized state.
sourcepub fn __do_init(this: &Self)where
F: FnOnce() -> T,
pub fn __do_init(this: &Self)where
F: FnOnce() -> T,
Ensure the value is initialized without optimization check
This is intended to be used at program start up by the dynamic macro.
sourcepub fn ensure_init(this: &Self)where
F: FnOnce() -> T,
pub fn ensure_init(this: &Self)where
F: FnOnce() -> T,
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.