pub struct InitStatic<T> { /* private fields */ }Expand description
A wrapper around OnceLock providing safe initialization and Deref support to mimic the
ergonomics of lazy_static!.
Values must be initialized exactly once, either via InitStatic::init or by calling
init_static(). Accessing an uninitialized value will panic.
Implementations§
Source§impl<T> InitStatic<T>
impl<T> InitStatic<T>
Sourcepub const fn new(symbol: &'static Symbol) -> Self
pub const fn new(symbol: &'static Symbol) -> Self
Creates a new uninitialized InitStatic.
The value must be initialized using InitStatic::init or via the initialization registry
before access.
Trait Implementations§
Source§impl<T: Debug> Debug for InitStatic<T>
impl<T: Debug> Debug for InitStatic<T>
Source§impl<T> Deref for InitStatic<T>
impl<T> Deref for InitStatic<T>
Source§impl<T> DerefMut for InitStatic<T>
impl<T> DerefMut for InitStatic<T>
Auto Trait Implementations§
impl<T> !Freeze for InitStatic<T>
impl<T> RefUnwindSafe for InitStatic<T>where
T: RefUnwindSafe + UnwindSafe,
impl<T> Send for InitStatic<T>where
T: Send,
impl<T> Sync for InitStatic<T>
impl<T> Unpin for InitStatic<T>where
T: Unpin,
impl<T> UnwindSafe for InitStatic<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more