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.