pub struct AtomicArc<T> { /* private fields */ }Expand description
A reference-counted, nullable, atomic pointer.
Implementations§
Source§impl<T> AtomicArc<T>
impl<T> AtomicArc<T>
Sourcepub fn get_arc(&mut self) -> Option<Arc<T>>
pub fn get_arc(&mut self) -> Option<Arc<T>>
Get the value of the pointer as an Arc.
This can be done non-atomically since we have a unique reference to the AtomicArc.
Sourcepub fn get(&mut self) -> Option<&T>
pub fn get(&mut self) -> Option<&T>
Get a reference to the value stored in this AtomicArc.
This can be done non-atomically since we have a unique reference to the AtomicArc.
Sourcepub fn swap(&self, new: Option<Arc<T>>, order: Ordering) -> Option<Arc<T>>
pub fn swap(&self, new: Option<Arc<T>>, order: Ordering) -> Option<Arc<T>>
Atomically swap the value stored in this AtomicArc with the new value, returning the old
value.
Sourcepub fn compare_and_swap(
&self,
old: Option<Arc<T>>,
new: Option<Arc<T>>,
order: Ordering,
) -> Option<Arc<T>>
pub fn compare_and_swap( &self, old: Option<Arc<T>>, new: Option<Arc<T>>, order: Ordering, ) -> Option<Arc<T>>
Atomically swaps the value stored in this AtomicArc if old points to the same Arc as
what is currently stored. This does not compare the underlying data, merely that the
pointers match. Returns the previous value stored in this AtomicArc, which will be the
same as old if the swap was successful.
Auto Trait Implementations§
impl<T> !Freeze for AtomicArc<T>
impl<T> RefUnwindSafe for AtomicArc<T>
impl<T> Send for AtomicArc<T>
impl<T> Sync for AtomicArc<T>
impl<T> Unpin for AtomicArc<T>
impl<T> UnwindSafe for AtomicArc<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