Struct loom::sync::atomic::AtomicUsize
source · pub struct AtomicUsize(_);
Expand description
Mock implementation of std::sync::atomic::AtomicUsize
.
Implementations
sourceimpl AtomicUsize
impl AtomicUsize
sourcepub fn new(v: usize) -> AtomicUsize
pub fn new(v: usize) -> AtomicUsize
Creates a new instance of AtomicUsize
.
sourcepub fn get_mut(&mut self) -> &mut usize
pub fn get_mut(&mut self) -> &mut usize
Returns a mutable reference to the underlying integer.
Panics
This function panics if the access is invalid under the Rust memory model.
sourcepub fn swap(&self, val: usize, order: Ordering) -> usize
pub fn swap(&self, val: usize, order: Ordering) -> usize
Stores a value into the atomic integer, returning the previous value.
sourcepub fn compare_and_swap(
&self,
current: usize,
new: usize,
order: Ordering
) -> usize
pub fn compare_and_swap(
&self,
current: usize,
new: usize,
order: Ordering
) -> usize
Stores a value into the atomic integer if the current value is the same as the current
value.
sourcepub fn compare_exchange(
&self,
current: usize,
new: usize,
success: Ordering,
failure: Ordering
) -> Result<usize, usize>
pub fn compare_exchange(
&self,
current: usize,
new: usize,
success: Ordering,
failure: Ordering
) -> Result<usize, usize>
Stores a value into the atomic integer if the current value is the same as the current
value.
sourcepub fn fetch_add(&self, val: usize, order: Ordering) -> usize
pub fn fetch_add(&self, val: usize, order: Ordering) -> usize
Adds to the current value, returning the previous value.
sourcepub fn fetch_sub(&self, val: usize, order: Ordering) -> usize
pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize
Subtracts from the current value, returning the previous value.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for AtomicUsize
impl !Send for AtomicUsize
impl !Sync for AtomicUsize
impl Unpin for AtomicUsize
impl UnwindSafe for AtomicUsize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more