Trait radium::marker::NumericOps
source · [−]pub trait NumericOps: BitOps { }
Expand description
Types supporting maybe-atomic arithmetic operations.
Types implementing this trait support the fetch_add
and
fetch_sub
maybe-atomic operations.
The integer types, such as usize
and i32
, implement this trait.
let num: AtomicUsize = AtomicUsize::new(2);
Radium::fetch_add(&num, 2, Ordering::Relaxed);
bool
and pointers do not. This will cause a compiler error.
ⓘ
let bit: AtomicBool = AtomicBool::new(false);
Radium::fetch_add(&bit, true, Ordering::Relaxed);