Skip to main content

PrimitiveAtomicInteger

Trait PrimitiveAtomicInteger 

Source
pub trait PrimitiveAtomicInteger: PrimitiveAtomic {
    const BITS: u32;

    // Required methods
    fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value;
    fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value;
    fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value;
    fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value;
}
Expand description

Trait for all primitive atomic integer types, extending PrimitiveAtomic.

This adds integer-specific atomic operations: fetch_add, fetch_sub, fetch_max, fetch_min, and a BITS constant.

This trait is sealed to prevent downstream implementations.

Required Associated Constants§

Source

const BITS: u32

The size of this atomic integer type in bits.

Required Methods§

Source

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

Adds to the current value, returning the previous value.

Source

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

Subtracts from the current value, returning the previous value.

Source

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

Stores the maximum of the current value and val. Returns the previous value.

Source

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

Stores the minimum of the current value and val. Returns the previous value.

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 PrimitiveAtomicInteger for AtomicI8

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 8

Source§

impl PrimitiveAtomicInteger for AtomicI16

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 16

Source§

impl PrimitiveAtomicInteger for AtomicI32

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 32

Source§

impl PrimitiveAtomicInteger for AtomicI64

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 64

Source§

impl PrimitiveAtomicInteger for AtomicIsize

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = isize::BITS

Source§

impl PrimitiveAtomicInteger for AtomicU8

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 8

Source§

impl PrimitiveAtomicInteger for AtomicU16

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 16

Source§

impl PrimitiveAtomicInteger for AtomicU32

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 32

Source§

impl PrimitiveAtomicInteger for AtomicU64

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = 64

Source§

impl PrimitiveAtomicInteger for AtomicUsize

Source§

fn fetch_add(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_add method.

Source§

fn fetch_sub(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_sub method.

Source§

fn fetch_max(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_max method.

Source§

fn fetch_min(&self, val: Self::Value, order: Ordering) -> Self::Value

See the inherent fetch_min method.

Source§

const BITS: u32 = usize::BITS

Implementors§