pub struct LesserLockedLazyDroped<T, G = fn() -> T> { /* private fields */ }
Expand description
The actual type of mutable statics attributed with #[dynamic(drop)] The method (new)Self::from_generator is unsafe because this kind of static can only safely be used through this attribute macros.
Implementations§
source§impl<T, G> LesserLockedLazyDroped<T, G>
impl<T, G> LesserLockedLazyDroped<T, G>
source§impl<T, G> LesserLockedLazyDroped<T, G>
impl<T, G> LesserLockedLazyDroped<T, G>
sourcepub fn read(&'static self) -> ReadGuard<'_, T>
pub fn read(&'static self) -> ReadGuard<'_, T>
Initialize if necessary and returns a read lock
§Panic
Panics if initialization panics or if initialization has panicked in a previous attempt to initialize.
sourcepub fn fast_read(&'static self) -> Option<ReadGuard<'_, T>>
pub fn fast_read(&'static self) -> Option<ReadGuard<'_, T>>
Initialize if necessary and returns some read lock if the lazy is not
already write locked. If the lazy is already write locked it returns None
§Panic
If locks succeeds, panics if initialization panics or if initialization has panicked in a previous attempt to initialize.
sourcepub fn try_read(&'static self) -> Result<ReadGuard<'_, T>, AccessError>
pub fn try_read(&'static self) -> Result<ReadGuard<'_, T>, AccessError>
Get a read lock if the lazy is initialized or an AccessError
sourcepub fn fast_try_read(
&'static self,
) -> Option<Result<ReadGuard<'_, T>, AccessError>>
pub fn fast_try_read( &'static self, ) -> Option<Result<ReadGuard<'_, T>, AccessError>>
if the lazy is not already write locked: get a read lock if the lazy is initialized
or an AccessError. Otherwise returns None
sourcepub fn write(&'static self) -> WriteGuard<'_, T>
pub fn write(&'static self) -> WriteGuard<'_, T>
Initialize if necessary and returns a write lock
§Panic
Panics if initialization panics or if initialization has panicked in a previous attempt to initialize.
sourcepub fn fast_write(&'static self) -> Option<WriteGuard<'_, T>>
pub fn fast_write(&'static self) -> Option<WriteGuard<'_, T>>
Initialize if necessary and returns some write lock if the lazy is not
already write locked. If the lazy is already read or write locked it returns None
§Panic
If locks succeeds, panics if initialization panics or if initialization has panicked in a previous attempt to initialize.
sourcepub fn try_write(&'static self) -> Result<WriteGuard<'_, T>, AccessError>
pub fn try_write(&'static self) -> Result<WriteGuard<'_, T>, AccessError>
Get a read lock if the lazy is initialized or an AccessError
sourcepub fn fast_try_write(
&'static self,
) -> Option<Result<WriteGuard<'_, T>, AccessError>>
pub fn fast_try_write( &'static self, ) -> Option<Result<WriteGuard<'_, T>, AccessError>>
if the lazy is not already read or write locked: get a write lock if the lazy is
initialized or an AccessError . Otherwise returns None
source§impl<T, G> LesserLockedLazyDroped<T, G>
impl<T, G> LesserLockedLazyDroped<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 build this object as anything else than a static or a thread local static would 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 informations.
§Safety
This function may be unsafe if build this object as anything else than a static or a thread local static would be the cause of undefined behavior