pub struct AtomPtr<T> { /* private fields */ }Expand description
A safe atomic pointer wrapper
Implementations§
Source§impl<T> AtomPtr<T>
impl<T> AtomPtr<T>
Sourcepub unsafe fn inplace_mut(&self) -> Option<&mut T>
pub unsafe fn inplace_mut(&self) -> Option<&mut T>
Load the current value and return a mutable reference to it in-place access to the underlying memory location.
This function returns None if the data is missing. In those cases you must still
setup the initial value manually.
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> Freeze for AtomPtr<T>
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