pub struct AtomPtr<T> { /* private fields */ }
Expand description
A safe atomic pointer wrapper
Implementations§
source§impl<T> AtomPtr<T>
impl<T> AtomPtr<T>
sourcepub fn compare_exchange(&self, prev: Ref<T>, new: T) -> CasResult<T>
pub fn compare_exchange(&self, prev: Ref<T>, new: T) -> CasResult<T>
Compare and swap this pointer for a new one
This API takes two pieces of data: a previously handed out data reference, and a new piece of data. The reference data will be compared to the existing value, and if they match, the new data is inserted into the pointer.
This API follows the
AtomicPtr::compare_exchange
API. The deprecated compare_and_swap
API is not
implemented.
sourcepub fn compare_exchange_weak(&self, prev: Ref<T>, new: T) -> CasResult<T>
pub fn compare_exchange_weak(&self, prev: Ref<T>, new: T) -> CasResult<T>
Compare and swap this pointer for a new one
Use this variant when called in a loop
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for AtomPtr<T>
impl<T> Send for AtomPtr<T>
impl<T> Sync for AtomPtr<T>
impl<T> Unpin for AtomPtr<T>
impl<T> UnwindSafe for AtomPtr<T>
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