pub struct AtomicOptionRef<T> { /* private fields */ }Expand description
An atomic reference that may be updated atomically.
Implementations§
Source§impl<T> AtomicOptionRef<T>
impl<T> AtomicOptionRef<T>
Sourcepub fn from(value: impl IntoOptionArc<T>) -> Self
pub fn from(value: impl IntoOptionArc<T>) -> Self
Creates a new atomic reference from the given initial value.
Sourcepub fn load(&self) -> Option<Arc<T>>
pub fn load(&self) -> Option<Arc<T>>
Loads and returns a reference to the value or None
if the value is not set.
Sourcepub fn store(&self, value: impl IntoOptionArc<T>)
pub fn store(&self, value: impl IntoOptionArc<T>)
Stores the value.
Sourcepub fn swap(&self, value: impl IntoOptionArc<T>) -> Option<Arc<T>>
pub fn swap(&self, value: impl IntoOptionArc<T>) -> Option<Arc<T>>
Swaps the value, returning the previous value.
Trait Implementations§
Source§impl<T> Default for AtomicOptionRef<T>
impl<T> Default for AtomicOptionRef<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicOptionRef<T>
impl<T> RefUnwindSafe for AtomicOptionRef<T>
impl<T> Send for AtomicOptionRef<T>
impl<T> Sync for AtomicOptionRef<T>
impl<T> Unpin for AtomicOptionRef<T>
impl<T> UnwindSafe for AtomicOptionRef<T>where
T: RefUnwindSafe,
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