pub struct PrimedLockedLazyDroped<T, G = fn() -> T> { /* private fields */ }
Expand description
The actual type of mutable statics attributed with #[dynamic(primed,drop)]
Implementations§
source§impl<T, G> PrimedLockedLazyDroped<T, G>
impl<T, G> PrimedLockedLazyDroped<T, G>
source§impl<T, G> PrimedLockedLazyDroped<T, G>
impl<T, G> PrimedLockedLazyDroped<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> PrimedLockedLazyDroped<T, G>
impl<T, G> PrimedLockedLazyDroped<T, G>
sourcepub const fn from_generator(v: T, f: G) -> Self
pub const fn from_generator(v: T, 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 fn from_generator_with_info(v: T, f: G, info: StaticInfo) -> Self
pub const fn from_generator_with_info(v: T, 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
source§impl<T, G> PrimedLockedLazyDroped<T, G>
impl<T, G> PrimedLockedLazyDroped<T, G>
sourcepub fn primed_read_non_initializing(
&'static self,
) -> Result<ReadGuard<'_, T>, ReadGuard<'_, T>>
pub fn primed_read_non_initializing( &'static self, ) -> Result<ReadGuard<'_, T>, ReadGuard<'_, T>>
Return a read lock to the initialized value or an error containing a read lock to the primed or post uninited value
sourcepub fn primed_read(&'static self) -> Result<ReadGuard<'_, T>, ReadGuard<'_, T>>
pub fn primed_read(&'static self) -> Result<ReadGuard<'_, T>, ReadGuard<'_, T>>
Initialize if possible and either return a read lock to the initialized value or an error containing a read lock to the primed or post uninited value
sourcepub fn primed_write_non_initializing(
&'static self,
) -> Result<WriteGuard<'_, T>, ReadGuard<'_, T>>
pub fn primed_write_non_initializing( &'static self, ) -> Result<WriteGuard<'_, T>, ReadGuard<'_, T>>
Return a write lock that refers to the initialized value or an error containing a read lock that refers to the primed or post uninited value
sourcepub fn primed_write(
&'static self,
) -> Result<WriteGuard<'_, T>, ReadGuard<'_, T>>
pub fn primed_write( &'static self, ) -> Result<WriteGuard<'_, T>, ReadGuard<'_, T>>
Initialize if possible and either return a write lock that refers to the initialized value or an error containing a read lock that refers to the primed or post uninited value