Struct static_init::ThreadLocalConstLazy
source · pub struct ThreadLocalConstLazy<T, F = fn() -> T>(_);
Expand description
The type of const thread local lazy that will be dropped.
This type does not implement DerefMut but is intended to be decalred mut to ensure access to is is unsafe.
Implementations§
source§impl<T, F> ConstLazy<T, F>
impl<T, F> ConstLazy<T, F>
sourcepub const fn new(f: F) -> Self
pub const fn new(f: F) -> Self
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
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
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.