pub struct Subatomic32<T: Copy + 'static> { /* private fields */ }Expand description
Wraps an 8-byte length T in an atomic, all operations are Ordering::SeqCst.
Implementations§
Source§impl<T: Copy + 'static> Subatomic32<T>
impl<T: Copy + 'static> Subatomic32<T>
Sourcepub fn swap(&self, item: T) -> T
pub fn swap(&self, item: T) -> T
Swap the interior value of the atomic wrapper, returning the previous value
Sourcepub fn compare_exchange(&self, current: T, new: T) -> Result<T, T>
pub fn compare_exchange(&self, current: T, new: T) -> Result<T, T>
Stores a value into the atomic integer if the current value is the same as the current value. The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to current.
Sourcepub fn compare_exchange_weak(&self, current: T, new: T) -> Result<T, T>
pub fn compare_exchange_weak(&self, current: T, new: T) -> Result<T, T>
Stores a value into the atomic integer if the current value is the same as the current value. Unlike compare_exchange, this function is allowed to spuriously fail even when the comparison succeeds, which can result in more efficient code on some platforms. The return value is a result indicating whether the new value was written and containing the previous value.