Skip to main content

RelaxedAtomic

Struct RelaxedAtomic 

Source
pub struct RelaxedAtomic<T> { /* private fields */ }
Expand description

Wrapper around atomic types that assumes Ordering::Relaxed for all operations to simplify pure relaxed use cases.

Implementations§

Source§

impl RelaxedAtomic<AtomicI8>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> i8

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: i8)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicI16>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> i16

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: i16)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicI32>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> i32

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: i32)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicI64>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> i64

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: i64)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicIsize>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> isize

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: isize)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicU8>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> u8

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: u8)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicU16>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> u16

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: u16)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicU32>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> u32

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: u32)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicU64>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> u64

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: u64)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed ordering.

Source§

impl RelaxedAtomic<AtomicUsize>

Source

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

Creates a new RelaxedAtomic.

Source

pub fn load(&self) -> usize

Loads the value with relaxed ordering.

Source

pub fn store(&self, desired: usize)

Stores the value with relaxed ordering.

Source

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

Adds to the current value, returning the previous value, with relaxed ordering.

Source

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

Subtracts from the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “and” with the current value, returning the previous value, with relaxed ordering.

Source

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

Bitwise “or” with the current value, returning the previous value, with relaxed 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.