pub struct OnceCell<T> { /* private fields */ }Expand description
A synchronization primitive that represents a value that is initialized at most once.
Implementations§
Source§impl<T> OnceCell<T>
impl<T> OnceCell<T>
Trait Implementations§
impl<T> Sync for OnceCell<T>
Safety:
- A
valueis only written to atomically and once. - A
valueis only readable from after the initialization process is finished. - A
initis only written and read from atomically.
Auto Trait Implementations§
impl<T> !Freeze for OnceCell<T>
impl<T> !RefUnwindSafe for OnceCell<T>
impl<T> Send for OnceCell<T>where
T: Send,
impl<T> Unpin for OnceCell<T>where
T: Unpin,
impl<T> UnwindSafe for OnceCell<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