Racy

Struct Racy 

Source
pub struct Racy<'a, T: RacyStorage>(/* private fields */);
Expand description

An opaque pointer to memory implementing the ECMAScript atomic memory model.

Implementations§

Source§

impl<T: RacyStorage> Racy<'_, T>

Source

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

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

The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to current.

The Ordering of the operation is always SeqCst.

Source

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

Adds to the current value, returning the previous value.

This operation wraps around on overflow.

The Ordering of the operation is always SeqCst.

Source

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

Bitwise “and” with the current value.

Performs a bitwise “and” operation on the current value and the argument val, and sets the new value to the result.

Returns the previous value.

The Ordering of the operation is always SeqCst.

Source

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

Bitwise “or” with the current value.

Performs a bitwise “or” operation on the current value and the argument val, and sets the new value to the result.

Returns the previous value.

The Ordering of the operation is always SeqCst.

Source

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

Bitwise “xor” with the current value.

Performs a bitwise “xor” operation on the current value and the argument val, and sets the new value to the result.

Returns the previous value.

The Ordering of the operation is always SeqCst.

Source

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

Loads a value from the atomic integer.

load takes an Ordering argument which describes the memory ordering of this operation. All ordering modes are possible.

Source

pub fn store(&self, val: T, order: Ordering)

Stores a value into the atomic integer.

store takes an Ordering argument which describes the memory ordering of this operation. All ordering modes are possible.

Source

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

Stores a value into the atomic integer, returning the previous value.

swap takes an Ordering argument which describes the memory ordering of this operation. All ordering modes are possible.

Trait Implementations§

Source§

impl<'a, T: Clone + RacyStorage> Clone for Racy<'a, T>

Source§

fn clone(&self) -> Racy<'a, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Copy + RacyStorage> Copy for Racy<'a, T>

Source§

impl<T: RacyStorage> Send for Racy<'_, T>

Source§

impl<T: RacyStorage> Sync for Racy<'_, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Racy<'a, T>

§

impl<'a, T> !RefUnwindSafe for Racy<'a, T>

§

impl<'a, T> Unpin for Racy<'a, T>

§

impl<'a, T> !UnwindSafe for Racy<'a, T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.