pub struct OnceLock<T> { /* private fields */ }Expand description
A synchronization primitive for one-time initialization.
Uses a three-state atomic with compare_exchange to ensure exactly
one thread performs initialization.
Implementations§
Source§impl<T> OnceLock<T>
impl<T> OnceLock<T>
Trait Implementations§
impl<T: Send> Send for OnceLock<T>
impl<T: Send> Sync for OnceLock<T>
Auto Trait Implementations§
impl<T> !Freeze for OnceLock<T>
impl<T> !RefUnwindSafe for OnceLock<T>
impl<T> Unpin for OnceLock<T>where
T: Unpin,
impl<T> UnsafeUnpin for OnceLock<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for OnceLock<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