[−][src]Struct crossbeam_utils::atomic::AtomicCell
A thread-safe mutable memory location.
This type is equivalent to Cell, except it can also be shared among multiple threads.
Operations on AtomicCells use atomic instructions whenever possible, and synchronize using
global locks otherwise. You can call AtomicCell::<T>::is_lock_free() to check whether
atomic instructions or locks will be used.
Methods
impl<T> AtomicCell<T>[src]
impl<T> AtomicCell<T>pub fn new(val: T) -> AtomicCell<T>[src]
pub fn new(val: T) -> AtomicCell<T>Creates a new atomic cell initialized with val.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7);
ⓘImportant traits for &'a mut Rpub fn get_mut(&mut self) -> &mut T[src]
pub fn get_mut(&mut self) -> &mut TReturns a mutable reference to the inner value.
Examples
use crossbeam_utils::atomic::AtomicCell; let mut a = AtomicCell::new(7); *a.get_mut() += 1; assert_eq!(a.load(), 8);
pub fn into_inner(self) -> T[src]
pub fn into_inner(self) -> TUnwraps the atomic cell and returns its inner value.
Examples
use crossbeam_utils::atomic::AtomicCell; let mut a = AtomicCell::new(7); let v = a.into_inner(); assert_eq!(v, 7);
pub fn is_lock_free() -> bool[src]
pub fn is_lock_free() -> boolReturns true if operations on values of this type are lock-free.
If the compiler or the platform doesn't support the necessary atomic instructions,
AtomicCell<T> will use global locks for every potentially concurrent atomic operation.
Examples
use crossbeam_utils::atomic::AtomicCell; // This type is internally represented as `AtomicUsize` so we can just use atomic // operations provided by it. assert_eq!(AtomicCell::<usize>::is_lock_free(), true); // A wrapper struct around `isize`. struct Foo { bar: isize, } // `AtomicCell<Foo>` will be internally represented as `AtomicIsize`. assert_eq!(AtomicCell::<Foo>::is_lock_free(), true); // Operations on zero-sized types are always lock-free. assert_eq!(AtomicCell::<()>::is_lock_free(), true); // Very large types cannot be represented as any of the standard atomic types, so atomic // operations on them will have to use global locks for synchronization. assert_eq!(AtomicCell::<[u8; 1000]>::is_lock_free(), false);
pub fn store(&self, val: T)[src]
pub fn store(&self, val: T)Stores val into the atomic cell.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7); assert_eq!(a.load(), 7); a.store(8); assert_eq!(a.load(), 8);
pub fn swap(&self, val: T) -> T[src]
pub fn swap(&self, val: T) -> TStores val into the atomic cell and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7); assert_eq!(a.load(), 7); assert_eq!(a.swap(8), 7); assert_eq!(a.load(), 8);
impl<T: Copy> AtomicCell<T>[src]
impl<T: Copy> AtomicCell<T>pub fn load(&self) -> T[src]
pub fn load(&self) -> TLoads a value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7); assert_eq!(a.load(), 7);
impl<T: Copy + Eq> AtomicCell<T>[src]
impl<T: Copy + Eq> AtomicCell<T>pub fn compare_and_swap(&self, current: T, new: T) -> T[src]
pub fn compare_and_swap(&self, current: T, new: T) -> TIf the current value equals current, stores new into the atomic cell.
The return value is always the previous value. If it is equal to current, then the value
was updated.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(1); assert_eq!(a.compare_exchange(2, 3), Err(1)); assert_eq!(a.load(), 1); assert_eq!(a.compare_exchange(1, 2), Ok(1)); assert_eq!(a.load(), 2);
pub fn compare_exchange(&self, current: T, new: T) -> Result<T, T>[src]
pub fn compare_exchange(&self, current: T, new: T) -> Result<T, T>If the current value equals current, stores new into the atomic cell.
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.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(1); assert_eq!(a.compare_exchange(2, 3), Err(1)); assert_eq!(a.load(), 1); assert_eq!(a.compare_exchange(1, 2), Ok(1)); assert_eq!(a.load(), 2);
impl AtomicCell<u8>[src]
impl AtomicCell<u8>pub fn fetch_add(&self, val: u8) -> u8[src]
pub fn fetch_add(&self, val: u8) -> u8Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u8); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: u8) -> u8[src]
pub fn fetch_sub(&self, val: u8) -> u8Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u8); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: u8) -> u8[src]
pub fn fetch_and(&self, val: u8) -> u8Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u8); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: u8) -> u8[src]
pub fn fetch_or(&self, val: u8) -> u8Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u8); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: u8) -> u8[src]
pub fn fetch_xor(&self, val: u8) -> u8Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u8); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<i8>[src]
impl AtomicCell<i8>pub fn fetch_add(&self, val: i8) -> i8[src]
pub fn fetch_add(&self, val: i8) -> i8Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i8); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: i8) -> i8[src]
pub fn fetch_sub(&self, val: i8) -> i8Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i8); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: i8) -> i8[src]
pub fn fetch_and(&self, val: i8) -> i8Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i8); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: i8) -> i8[src]
pub fn fetch_or(&self, val: i8) -> i8Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i8); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: i8) -> i8[src]
pub fn fetch_xor(&self, val: i8) -> i8Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i8); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<u16>[src]
impl AtomicCell<u16>pub fn fetch_add(&self, val: u16) -> u16[src]
pub fn fetch_add(&self, val: u16) -> u16Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u16); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: u16) -> u16[src]
pub fn fetch_sub(&self, val: u16) -> u16Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u16); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: u16) -> u16[src]
pub fn fetch_and(&self, val: u16) -> u16Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u16); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: u16) -> u16[src]
pub fn fetch_or(&self, val: u16) -> u16Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u16); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: u16) -> u16[src]
pub fn fetch_xor(&self, val: u16) -> u16Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u16); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<i16>[src]
impl AtomicCell<i16>pub fn fetch_add(&self, val: i16) -> i16[src]
pub fn fetch_add(&self, val: i16) -> i16Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i16); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: i16) -> i16[src]
pub fn fetch_sub(&self, val: i16) -> i16Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i16); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: i16) -> i16[src]
pub fn fetch_and(&self, val: i16) -> i16Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i16); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: i16) -> i16[src]
pub fn fetch_or(&self, val: i16) -> i16Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i16); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: i16) -> i16[src]
pub fn fetch_xor(&self, val: i16) -> i16Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i16); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<u32>[src]
impl AtomicCell<u32>pub fn fetch_add(&self, val: u32) -> u32[src]
pub fn fetch_add(&self, val: u32) -> u32Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u32); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: u32) -> u32[src]
pub fn fetch_sub(&self, val: u32) -> u32Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u32); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: u32) -> u32[src]
pub fn fetch_and(&self, val: u32) -> u32Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u32); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: u32) -> u32[src]
pub fn fetch_or(&self, val: u32) -> u32Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u32); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: u32) -> u32[src]
pub fn fetch_xor(&self, val: u32) -> u32Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u32); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<i32>[src]
impl AtomicCell<i32>pub fn fetch_add(&self, val: i32) -> i32[src]
pub fn fetch_add(&self, val: i32) -> i32Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i32); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: i32) -> i32[src]
pub fn fetch_sub(&self, val: i32) -> i32Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i32); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: i32) -> i32[src]
pub fn fetch_and(&self, val: i32) -> i32Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i32); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: i32) -> i32[src]
pub fn fetch_or(&self, val: i32) -> i32Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i32); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: i32) -> i32[src]
pub fn fetch_xor(&self, val: i32) -> i32Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i32); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<u64>[src]
impl AtomicCell<u64>pub fn fetch_add(&self, val: u64) -> u64[src]
pub fn fetch_add(&self, val: u64) -> u64Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u64); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: u64) -> u64[src]
pub fn fetch_sub(&self, val: u64) -> u64Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u64); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: u64) -> u64[src]
pub fn fetch_and(&self, val: u64) -> u64Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u64); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: u64) -> u64[src]
pub fn fetch_or(&self, val: u64) -> u64Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u64); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: u64) -> u64[src]
pub fn fetch_xor(&self, val: u64) -> u64Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7u64); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<i64>[src]
impl AtomicCell<i64>pub fn fetch_add(&self, val: i64) -> i64[src]
pub fn fetch_add(&self, val: i64) -> i64Increments the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i64); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: i64) -> i64[src]
pub fn fetch_sub(&self, val: i64) -> i64Decrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i64); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: i64) -> i64[src]
pub fn fetch_and(&self, val: i64) -> i64Applies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i64); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: i64) -> i64[src]
pub fn fetch_or(&self, val: i64) -> i64Applies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i64); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: i64) -> i64[src]
pub fn fetch_xor(&self, val: i64) -> i64Applies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7i64); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<usize>[src]
impl AtomicCell<usize>pub fn fetch_add(&self, val: usize) -> usize[src]
pub fn fetch_add(&self, val: usize) -> usizeIncrements the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7usize); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: usize) -> usize[src]
pub fn fetch_sub(&self, val: usize) -> usizeDecrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7usize); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: usize) -> usize[src]
pub fn fetch_and(&self, val: usize) -> usizeApplies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7usize); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: usize) -> usize[src]
pub fn fetch_or(&self, val: usize) -> usizeApplies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7usize); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: usize) -> usize[src]
pub fn fetch_xor(&self, val: usize) -> usizeApplies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7usize); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<isize>[src]
impl AtomicCell<isize>pub fn fetch_add(&self, val: isize) -> isize[src]
pub fn fetch_add(&self, val: isize) -> isizeIncrements the current value by val and returns the previous value.
The addition wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7isize); assert_eq!(a.fetch_add(3), 7); assert_eq!(a.load(), 10);
pub fn fetch_sub(&self, val: isize) -> isize[src]
pub fn fetch_sub(&self, val: isize) -> isizeDecrements the current value by val and returns the previous value.
The subtraction wraps on overflow.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7isize); assert_eq!(a.fetch_sub(3), 7); assert_eq!(a.load(), 4);
pub fn fetch_and(&self, val: isize) -> isize[src]
pub fn fetch_and(&self, val: isize) -> isizeApplies bitwise "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7isize); assert_eq!(a.fetch_and(3), 7); assert_eq!(a.load(), 3);
pub fn fetch_or(&self, val: isize) -> isize[src]
pub fn fetch_or(&self, val: isize) -> isizeApplies bitwise "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7isize); assert_eq!(a.fetch_or(16), 7); assert_eq!(a.load(), 23);
pub fn fetch_xor(&self, val: isize) -> isize[src]
pub fn fetch_xor(&self, val: isize) -> isizeApplies bitwise "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(7isize); assert_eq!(a.fetch_xor(2), 7); assert_eq!(a.load(), 5);
impl AtomicCell<bool>[src]
impl AtomicCell<bool>pub fn fetch_and(&self, val: bool) -> bool[src]
pub fn fetch_and(&self, val: bool) -> boolApplies logical "and" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(true); assert_eq!(a.fetch_and(true), true); assert_eq!(a.load(), true); assert_eq!(a.fetch_and(false), true); assert_eq!(a.load(), false);
pub fn fetch_or(&self, val: bool) -> bool[src]
pub fn fetch_or(&self, val: bool) -> boolApplies logical "or" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(false); assert_eq!(a.fetch_or(false), false); assert_eq!(a.load(), false); assert_eq!(a.fetch_or(true), false); assert_eq!(a.load(), true);
pub fn fetch_xor(&self, val: bool) -> bool[src]
pub fn fetch_xor(&self, val: bool) -> boolApplies logical "xor" to the current value and returns the previous value.
Examples
use crossbeam_utils::atomic::AtomicCell; let a = AtomicCell::new(true); assert_eq!(a.fetch_xor(false), true); assert_eq!(a.load(), true); assert_eq!(a.fetch_xor(true), true); assert_eq!(a.load(), false);
Trait Implementations
impl<T: Send> Sync for AtomicCell<T>[src]
impl<T: Send> Sync for AtomicCell<T>impl<T: Default> Default for AtomicCell<T>[src]
impl<T: Default> Default for AtomicCell<T>fn default() -> AtomicCell<T>[src]
fn default() -> AtomicCell<T>Returns the "default value" for a type. Read more
impl<T: Send> Send for AtomicCell<T>[src]
impl<T: Send> Send for AtomicCell<T>impl<T: Copy + Debug> Debug for AtomicCell<T>[src]
impl<T: Copy + Debug> Debug for AtomicCell<T>Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T[src]
fn borrow(&self) -> &TImmutably borrows from an owned value. Read more
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more