pub trait AtomicNumber: Atomic {
// Required methods
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;
}Expand description
Trait for atomic numeric types that support arithmetic operations.
Provides common arithmetic operations (add, subtract, multiply, divide) for both integer and floating-point atomic types. This trait unifies the arithmetic interface across all numeric atomic types.
§Note
Integer types also provide fetch_inc() and fetch_dec() methods
as convenient shortcuts for incrementing/decrementing by 1, but these
are not part of this trait as they are integer-specific operations.
§Author
Haixing Hu
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.