pub struct NativeAtomicElement<T> { /* private fields */ }Expand description
NativeAtomicElement represents a native (like AtomicUsize, AtomicU8, etc.) atomic element in a NativeAtomicArray.
Implementations§
Source§impl<T: Dist> NativeAtomicElement<T>
impl<T: Dist> NativeAtomicElement<T>
Sourcepub fn swap(&self, val: T) -> T
pub fn swap(&self, val: T) -> T
Atomically replaces the current value with val and returns the old value.
Sourcepub fn compare_exchange(&self, old: T, new: T) -> Result<T, T>
pub fn compare_exchange(&self, old: T, new: T) -> Result<T, T>
Performs an atomic compare and exchange operation on the atomic element.
The operation succeeds if the current value is equal to old. If successful, it replaces the current value with new and returns the old value.
If the current value is not equal to old, it returns the current value without making any changes.
Sourcepub fn compare_exchange_epsilon(&self, old: T, new: T, eps: T) -> Result<T, T>
pub fn compare_exchange_epsilon(&self, old: T, new: T, eps: T) -> Result<T, T>
Performs an atomic compare and exchange operation with an epsilon value.
This operation succeeds if the absolute difference between the current value and old is less than eps. If successful, it replaces the current value with new and returns the old value.
If the absolute difference is greater than or equal to eps, it returns the current value without making any changes.
Sourcepub fn fetch_add(&self, val: T) -> T
pub fn fetch_add(&self, val: T) -> T
Atomically adds val to the current value and returns the old value.
Sourcepub fn fetch_sub(&self, val: T) -> T
pub fn fetch_sub(&self, val: T) -> T
Atomically subtracts val from the current value and returns the old value.
Sourcepub fn fetch_mul(&self, val: T) -> T
pub fn fetch_mul(&self, val: T) -> T
Atomically multiplies the current value by val and returns the old value.
Sourcepub fn fetch_div(&self, val: T) -> T
pub fn fetch_div(&self, val: T) -> T
Atomically divides the current value by val and returns the old value.
Sourcepub fn fetch_rem(&self, val: T) -> T
pub fn fetch_rem(&self, val: T) -> T
Atomically computes the remainder of the current value divided by val and returns the old value.
Source§impl<T: ElementBitWiseOps + 'static> NativeAtomicElement<T>
impl<T: ElementBitWiseOps + 'static> NativeAtomicElement<T>
Trait Implementations§
Source§impl<T: Dist + ElementArithmeticOps> AddAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementArithmeticOps> AddAssign<T> for NativeAtomicElement<T>
Source§fn add_assign(&mut self, val: T)
fn add_assign(&mut self, val: T)
+= operation. Read moreSource§impl<T: Dist + ElementBitWiseOps> BitAndAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementBitWiseOps> BitAndAssign<T> for NativeAtomicElement<T>
Source§fn bitand_assign(&mut self, val: T)
fn bitand_assign(&mut self, val: T)
&= operation. Read moreSource§impl<T: Dist + ElementBitWiseOps> BitOrAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementBitWiseOps> BitOrAssign<T> for NativeAtomicElement<T>
Source§fn bitor_assign(&mut self, val: T)
fn bitor_assign(&mut self, val: T)
|= operation. Read moreSource§impl<T: Dist + ElementBitWiseOps> BitXorAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementBitWiseOps> BitXorAssign<T> for NativeAtomicElement<T>
Source§fn bitxor_assign(&mut self, val: T)
fn bitxor_assign(&mut self, val: T)
^= operation. Read moreSource§impl<T: Dist + ElementArithmeticOps> DivAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementArithmeticOps> DivAssign<T> for NativeAtomicElement<T>
Source§fn div_assign(&mut self, val: T)
fn div_assign(&mut self, val: T)
/= operation. Read moreSource§impl<T: Dist> From<NativeAtomicElement<T>> for AtomicElement<T>
impl<T: Dist> From<NativeAtomicElement<T>> for AtomicElement<T>
Source§fn from(element: NativeAtomicElement<T>) -> AtomicElement<T>
fn from(element: NativeAtomicElement<T>) -> AtomicElement<T>
Source§impl<T: Dist + ElementArithmeticOps> MulAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementArithmeticOps> MulAssign<T> for NativeAtomicElement<T>
Source§fn mul_assign(&mut self, val: T)
fn mul_assign(&mut self, val: T)
*= operation. Read moreSource§impl<T: Dist + ElementArithmeticOps> RemAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementArithmeticOps> RemAssign<T> for NativeAtomicElement<T>
Source§fn rem_assign(&mut self, val: T)
fn rem_assign(&mut self, val: T)
%= operation. Read moreSource§impl<T: Dist + ElementShiftOps> ShlAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementShiftOps> ShlAssign<T> for NativeAtomicElement<T>
Source§fn shl_assign(&mut self, val: T)
fn shl_assign(&mut self, val: T)
<<= operation. Read moreSource§impl<T: Dist + ElementShiftOps> ShrAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementShiftOps> ShrAssign<T> for NativeAtomicElement<T>
Source§fn shr_assign(&mut self, val: T)
fn shr_assign(&mut self, val: T)
>>= operation. Read moreSource§impl<T: Dist + ElementArithmeticOps> SubAssign<T> for NativeAtomicElement<T>
impl<T: Dist + ElementArithmeticOps> SubAssign<T> for NativeAtomicElement<T>
Source§fn sub_assign(&mut self, val: T)
fn sub_assign(&mut self, val: T)
-= operation. Read more