pub trait AtomicAdd<T = <Self as Atomic>::Primitive>: Atomic {
// Required method
fn fetch_add(&self, val: T, order: Ordering) -> Self::Primitive;
}
Expand description
A trait representing atomic types that support addition operations.
Required Methods§
Sourcefn fetch_add(&self, val: T, order: Ordering) -> Self::Primitive
fn fetch_add(&self, val: T, order: Ordering) -> Self::Primitive
Adds to the current value, returning the previous value.
This operation wraps around on overflow.
fetch_add
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
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.
Implementations on Foreign Types§
Source§impl AtomicAdd for AtomicIsize
Available on target_has_atomic="ptr"
only.
impl AtomicAdd for AtomicIsize
Available on
target_has_atomic="ptr"
only.Source§impl AtomicAdd for AtomicUsize
Available on target_has_atomic="ptr"
only.
impl AtomicAdd for AtomicUsize
Available on
target_has_atomic="ptr"
only.