Skip to main content

Atomic

Trait Atomic 

Source
pub trait Atomic {
    type Value: Copy + PartialEq;

    // Required methods
    fn load(&self, ordering: Ordering) -> Self::Value;
    fn compare_exchange_weak(
        &self,
        current: Self::Value,
        new: Self::Value,
        success: Ordering,
        failure: Ordering,
    ) -> Result<Self::Value, Self::Value>;
}
Expand description

An atomic type.

Required Associated Types§

Source

type Value: Copy + PartialEq

The value of the atomic.

Required Methods§

Source

fn load(&self, ordering: Ordering) -> Self::Value

Load the value of the atomic.

Source

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Stores a value into the atomic if the current value is the same as the current value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Atomic for AtomicBool

Source§

type Value = bool

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicI8

Source§

type Value = i8

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicI16

Source§

type Value = i16

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicI32

Source§

type Value = i32

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicI64

Source§

type Value = i64

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicIsize

Source§

type Value = isize

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicU8

Source§

type Value = u8

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicU16

Source§

type Value = u16

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicU32

Source§

type Value = u32

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicU64

Source§

type Value = u64

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl Atomic for AtomicUsize

Source§

type Value = usize

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Source§

impl<T> Atomic for AtomicPtr<T>

Source§

type Value = *mut T

Source§

fn load(&self, ordering: Ordering) -> Self::Value

Source§

fn compare_exchange_weak( &self, current: Self::Value, new: Self::Value, success: Ordering, failure: Ordering, ) -> Result<Self::Value, Self::Value>

Implementors§