Skip to main content

RelaxedAtomic

Struct RelaxedAtomic 

Source
pub struct RelaxedAtomic<T>(/* private fields */);
Expand description

A wrapper around an atomic primitive providing relaxed memory ordering operations.

Implementations§

Source§

impl RelaxedAtomic<AtomicBool>

Source

pub const fn new(val: bool) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> bool

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: bool)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: bool) -> bool

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: bool, new: bool) -> Result<bool, bool>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak( &self, current: bool, new: bool, ) -> Result<bool, bool>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI8>

Source

pub const fn new(val: i8) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> i8

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: i8)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: i8) -> i8

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: i8, new: i8) -> Result<i8, i8>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: i8, new: i8) -> Result<i8, i8>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI8>

Source

pub fn fetch_add(&self, val: i8) -> i8

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: i8) -> i8

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: i8) -> i8

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: i8) -> i8

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: i8) -> i8

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: i8) -> i8

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: i8) -> i8

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: i8) -> i8

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI16>

Source

pub const fn new(val: i16) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> i16

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: i16)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: i16) -> i16

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: i16, new: i16) -> Result<i16, i16>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: i16, new: i16) -> Result<i16, i16>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI16>

Source

pub fn fetch_add(&self, val: i16) -> i16

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: i16) -> i16

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: i16) -> i16

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: i16) -> i16

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: i16) -> i16

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: i16) -> i16

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: i16) -> i16

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: i16) -> i16

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI32>

Source

pub const fn new(val: i32) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> i32

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: i32)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: i32) -> i32

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: i32, new: i32) -> Result<i32, i32>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: i32, new: i32) -> Result<i32, i32>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI32>

Source

pub fn fetch_add(&self, val: i32) -> i32

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: i32) -> i32

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: i32) -> i32

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: i32) -> i32

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: i32) -> i32

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: i32) -> i32

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: i32) -> i32

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: i32) -> i32

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI64>

Source

pub const fn new(val: i64) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> i64

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: i64)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: i64) -> i64

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: i64, new: i64) -> Result<i64, i64>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: i64, new: i64) -> Result<i64, i64>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicI64>

Source

pub fn fetch_add(&self, val: i64) -> i64

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: i64) -> i64

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: i64) -> i64

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: i64) -> i64

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: i64) -> i64

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: i64) -> i64

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: i64) -> i64

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: i64) -> i64

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicIsize>

Source

pub const fn new(val: isize) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> isize

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: isize)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: isize) -> isize

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange( &self, current: isize, new: isize, ) -> Result<isize, isize>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak( &self, current: isize, new: isize, ) -> Result<isize, isize>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicIsize>

Source

pub fn fetch_add(&self, val: isize) -> isize

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: isize) -> isize

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: isize) -> isize

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: isize) -> isize

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: isize) -> isize

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: isize) -> isize

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: isize) -> isize

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: isize) -> isize

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU8>

Source

pub const fn new(val: u8) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> u8

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: u8)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: u8) -> u8

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: u8, new: u8) -> Result<u8, u8>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: u8, new: u8) -> Result<u8, u8>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU8>

Source

pub fn fetch_add(&self, val: u8) -> u8

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: u8) -> u8

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: u8) -> u8

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: u8) -> u8

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: u8) -> u8

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: u8) -> u8

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: u8) -> u8

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: u8) -> u8

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU16>

Source

pub const fn new(val: u16) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> u16

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: u16)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: u16) -> u16

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: u16, new: u16) -> Result<u16, u16>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: u16, new: u16) -> Result<u16, u16>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU16>

Source

pub fn fetch_add(&self, val: u16) -> u16

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: u16) -> u16

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: u16) -> u16

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: u16) -> u16

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: u16) -> u16

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: u16) -> u16

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: u16) -> u16

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: u16) -> u16

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU32>

Source

pub const fn new(val: u32) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> u32

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: u32)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: u32) -> u32

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: u32, new: u32) -> Result<u32, u32>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: u32, new: u32) -> Result<u32, u32>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU32>

Source

pub fn fetch_add(&self, val: u32) -> u32

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: u32) -> u32

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: u32) -> u32

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: u32) -> u32

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: u32) -> u32

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: u32) -> u32

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: u32) -> u32

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: u32) -> u32

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU64>

Source

pub const fn new(val: u64) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> u64

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: u64)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: u64) -> u64

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange(&self, current: u64, new: u64) -> Result<u64, u64>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak(&self, current: u64, new: u64) -> Result<u64, u64>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicU64>

Source

pub fn fetch_add(&self, val: u64) -> u64

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: u64) -> u64

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: u64) -> u64

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: u64) -> u64

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: u64) -> u64

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: u64) -> u64

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: u64) -> u64

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: u64) -> u64

Computes minimum with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicUsize>

Source

pub const fn new(val: usize) -> Self

Creates a new relaxed atomic initialized with val.

Source

pub fn load(&self) -> usize

Loads the value with relaxed memory ordering.

Source

pub fn store(&self, val: usize)

Stores a value with relaxed memory ordering.

Source

pub fn swap(&self, val: usize) -> usize

Swaps a value with relaxed memory ordering.

Source

pub fn compare_exchange( &self, current: usize, new: usize, ) -> Result<usize, usize>

Performs compare-and-exchange with relaxed memory ordering.

Source

pub fn compare_exchange_weak( &self, current: usize, new: usize, ) -> Result<usize, usize>

Performs weak compare-and-exchange with relaxed memory ordering.

Source§

impl RelaxedAtomic<AtomicUsize>

Source

pub fn fetch_add(&self, val: usize) -> usize

Adds to the value with relaxed memory ordering.

Source

pub fn fetch_sub(&self, val: usize) -> usize

Subtracts from the value with relaxed memory ordering.

Source

pub fn fetch_and(&self, val: usize) -> usize

Bitwise ANDs the value with relaxed memory ordering.

Source

pub fn fetch_nand(&self, val: usize) -> usize

Bitwise NANDs the value with relaxed memory ordering.

Source

pub fn fetch_or(&self, val: usize) -> usize

Bitwise ORs the value with relaxed memory ordering.

Source

pub fn fetch_xor(&self, val: usize) -> usize

Bitwise XORs the value with relaxed memory ordering.

Source

pub fn fetch_max(&self, val: usize) -> usize

Computes maximum with relaxed memory ordering.

Source

pub fn fetch_min(&self, val: usize) -> usize

Computes minimum with relaxed memory ordering.

Trait Implementations§

Source§

impl<T: Debug> Debug for RelaxedAtomic<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for RelaxedAtomic<T>

Source§

fn default() -> RelaxedAtomic<T>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RelaxedAtomic<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for RelaxedAtomic<T>
where T: RefUnwindSafe,

§

impl<T> Send for RelaxedAtomic<T>
where T: Send,

§

impl<T> Sync for RelaxedAtomic<T>
where T: Sync,

§

impl<T> Unpin for RelaxedAtomic<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for RelaxedAtomic<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for RelaxedAtomic<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.