Struct static_init::lazy::LesserLazyFinalize
source · pub struct LesserLazyFinalize<T, G = fn() -> T> { /* private fields */ }
Expand description
The actual type of statics attributed with #[dynamic(finalize)]. The method from_generator is unsafe because this kind of static can only safely be used through this attribute macros.
Implementations§
source§impl<T, G> LesserLazyFinalize<T, G>
impl<T, G> LesserLazyFinalize<T, G>
sourcepub const unsafe fn from_generator(f: G) -> Self
pub const unsafe fn from_generator(f: G) -> Self
Build a new static object
§Safety
This function may be unsafe if building any thing else than a thread local object or a static will be the cause of undefined behavior
sourcepub const unsafe fn from_generator_with_info(f: G, info: StaticInfo) -> Self
pub const unsafe fn from_generator_with_info(f: G, info: StaticInfo) -> Self
Build a new static object with debug information
§Safety
This function may be unsafe if building any thing else than a thread local object or a static will be the cause of undefined behavior
source§impl<T, G> LesserLazyFinalize<T, G>
impl<T, G> LesserLazyFinalize<T, G>
sourcepub fn try_get(this: &'static Self) -> Result<&'static T, AccessError>
pub fn try_get(this: &'static Self) -> Result<&'static T, AccessError>
Return a reference to the target if initialized otherwise return an error.
sourcepub fn get(this: &'static Self) -> &'static T
pub fn get(this: &'static Self) -> &'static T
Initialize if necessary then return a reference to the target.
§Panics
Panic if previous attempt to initialize has panicked and the lazy policy does not tolorate further initialization attempt or if initialization panic.
sourcepub fn phase(this: &'static Self) -> Phase
pub fn phase(this: &'static Self) -> Phase
Return the phase