pub trait Atomic {
type Value;
fn load(&self) -> Self::Value;
fn store(&self, value: Self::Value);
fn swap(&self, value: Self::Value) -> Self::Value;
fn compare_set(&self, current: Self::Value, new: Self::Value) -> Result<(), Self::Value>;
fn compare_set_weak(&self, current: Self::Value, new: Self::Value) -> Result<(), Self::Value>;
fn compare_exchange(&self, current: Self::Value, new: Self::Value) -> Self::Value;
fn compare_exchange_weak(&self, current: Self::Value, new: Self::Value) -> Self::Value;
fn fetch_update<F>(&self, f: F) -> Self::Value
where
F: Fn(Self::Value) -> Self::Value;
}
pub trait AtomicNumber: Atomic {
fn fetch_add(&self, delta: Self::Value) -> Self::Value;
fn fetch_sub(&self, delta: Self::Value) -> Self::Value;
fn fetch_mul(&self, factor: Self::Value) -> Self::Value;
fn fetch_div(&self, divisor: Self::Value) -> Self::Value;
}