AtomicOps

Trait AtomicOps 

Source
pub trait AtomicOps<T> {
    // Required methods
    fn atomic_new(v: T) -> Self;
    fn atomic_load(&self, order: Ordering) -> T;
    fn atomic_store(&self, v: T, order: Ordering);
    fn atomic_swap(&self, v: T, order: Ordering) -> T;
    fn atomic_compare_exchange(
        &self,
        curr: T,
        new: T,
        success: Ordering,
        failure: Ordering,
    ) -> Result<T, T>;
}
Expand description

This trait must be implemented for the underlying atomic type.

The trait is already implemented for:

  • AtomicU8
  • AtomicU16
  • AtomicU32
  • AtomicU64 with the u64 feature.
  • AtomicUsize with the usize feature.

Required Methods§

Source

fn atomic_new(v: T) -> Self

Source

fn atomic_load(&self, order: Ordering) -> T

Source

fn atomic_store(&self, v: T, order: Ordering)

Source

fn atomic_swap(&self, v: T, order: Ordering) -> T

Source

fn atomic_compare_exchange( &self, curr: T, new: T, success: Ordering, failure: Ordering, ) -> Result<T, T>

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 AtomicOps<u8> for AtomicU8

Source§

fn atomic_new(v: u8) -> Self

Source§

fn atomic_compare_exchange( &self, curr: u8, new: u8, success: Ordering, failure: Ordering, ) -> Result<u8, u8>

Source§

fn atomic_load(&self, order: Ordering) -> u8

Source§

fn atomic_store(&self, v: u8, order: Ordering)

Source§

fn atomic_swap(&self, v: u8, order: Ordering) -> u8

Source§

impl AtomicOps<u16> for AtomicU16

Source§

fn atomic_new(v: u16) -> Self

Source§

fn atomic_compare_exchange( &self, curr: u16, new: u16, success: Ordering, failure: Ordering, ) -> Result<u16, u16>

Source§

fn atomic_load(&self, order: Ordering) -> u16

Source§

fn atomic_store(&self, v: u16, order: Ordering)

Source§

fn atomic_swap(&self, v: u16, order: Ordering) -> u16

Source§

impl AtomicOps<u32> for AtomicU32

Source§

fn atomic_new(v: u32) -> Self

Source§

fn atomic_compare_exchange( &self, curr: u32, new: u32, success: Ordering, failure: Ordering, ) -> Result<u32, u32>

Source§

fn atomic_load(&self, order: Ordering) -> u32

Source§

fn atomic_store(&self, v: u32, order: Ordering)

Source§

fn atomic_swap(&self, v: u32, order: Ordering) -> u32

Source§

impl AtomicOps<u64> for AtomicU64

Source§

fn atomic_new(v: u64) -> Self

Source§

fn atomic_compare_exchange( &self, curr: u64, new: u64, success: Ordering, failure: Ordering, ) -> Result<u64, u64>

Source§

fn atomic_load(&self, order: Ordering) -> u64

Source§

fn atomic_store(&self, v: u64, order: Ordering)

Source§

fn atomic_swap(&self, v: u64, order: Ordering) -> u64

Source§

impl AtomicOps<usize> for AtomicUsize

Source§

fn atomic_new(v: usize) -> Self

Source§

fn atomic_compare_exchange( &self, curr: usize, new: usize, success: Ordering, failure: Ordering, ) -> Result<usize, usize>

Source§

fn atomic_load(&self, order: Ordering) -> usize

Source§

fn atomic_store(&self, v: usize, order: Ordering)

Source§

fn atomic_swap(&self, v: usize, order: Ordering) -> usize

Implementors§