Skip to main content

NativeAtomicElement

Struct NativeAtomicElement 

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

NativeAtomicElement represents a native (like AtomicUsize, AtomicU8, etc.) atomic element in a NativeAtomicArray.

Implementations§

Source§

impl<T: Dist> NativeAtomicElement<T>

Source

pub fn load(&self) -> T

returns the value of the atomic element

Source

pub fn store(&self, val: T)

stores a value into the atomic element

Source

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

Atomically replaces the current value with val and returns the old value.

Source

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

Performs an atomic compare and exchange operation on the atomic element. The operation succeeds if the current value is equal to old. If successful, it replaces the current value with new and returns the old value. If the current value is not equal to old, it returns the current value without making any changes.

Source

pub fn compare_exchange_epsilon(&self, old: T, new: T, eps: T) -> Result<T, T>

Performs an atomic compare and exchange operation with an epsilon value. This operation succeeds if the absolute difference between the current value and old is less than eps. If successful, it replaces the current value with new and returns the old value. If the absolute difference is greater than or equal to eps, it returns the current value without making any changes.

Source

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

Atomically adds val to the current value and returns the old value.

Source

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

Atomically subtracts val from the current value and returns the old value.

Source

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

Atomically multiplies the current value by val and returns the old value.

Source

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

Atomically divides the current value by val and returns the old value.

Source

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

Atomically computes the remainder of the current value divided by val and returns the old value.

Source

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

Atomically shifts the current value left by val and returns the old value.

Source

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

Atomically shifts the current value right by val and returns the old value.

Source§

impl<T: ElementBitWiseOps + 'static> NativeAtomicElement<T>

Source

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

Atomically performs a bitwise AND operation with val and returns the old value.

Source

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

Atomically performs a bitwise OR operation with val and returns the old value.

Source

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

Atomically performs a bitwise XOR operation with val and returns the old value.

Trait Implementations§

Source§

impl<T: Dist + ElementArithmeticOps> AddAssign<T> for NativeAtomicElement<T>

Source§

fn add_assign(&mut self, val: T)

Performs the += operation. Read more
Source§

impl<T: Dist + ElementBitWiseOps> BitAndAssign<T> for NativeAtomicElement<T>

Source§

fn bitand_assign(&mut self, val: T)

Performs the &= operation. Read more
Source§

impl<T: Dist + ElementBitWiseOps> BitOrAssign<T> for NativeAtomicElement<T>

Source§

fn bitor_assign(&mut self, val: T)

Performs the |= operation. Read more
Source§

impl<T: Dist + ElementBitWiseOps> BitXorAssign<T> for NativeAtomicElement<T>

Source§

fn bitxor_assign(&mut self, val: T)

Performs the ^= operation. Read more
Source§

impl<T: Dist + Debug> Debug for NativeAtomicElement<T>

Source§

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

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

impl<T: Dist + ElementArithmeticOps> DivAssign<T> for NativeAtomicElement<T>

Source§

fn div_assign(&mut self, val: T)

Performs the /= operation. Read more
Source§

impl<T: Dist> From<NativeAtomicElement<T>> for AtomicElement<T>

Source§

fn from(element: NativeAtomicElement<T>) -> AtomicElement<T>

Converts to this type from the input type.
Source§

impl<T: Dist + ElementArithmeticOps> MulAssign<T> for NativeAtomicElement<T>

Source§

fn mul_assign(&mut self, val: T)

Performs the *= operation. Read more
Source§

impl<T: Dist + ElementArithmeticOps> RemAssign<T> for NativeAtomicElement<T>

Source§

fn rem_assign(&mut self, val: T)

Performs the %= operation. Read more
Source§

impl<T: Dist + ElementShiftOps> ShlAssign<T> for NativeAtomicElement<T>

Source§

fn shl_assign(&mut self, val: T)

Performs the <<= operation. Read more
Source§

impl<T: Dist + ElementShiftOps> ShrAssign<T> for NativeAtomicElement<T>

Source§

fn shr_assign(&mut self, val: T)

Performs the >>= operation. Read more
Source§

impl<T: Dist + ElementArithmeticOps> SubAssign<T> for NativeAtomicElement<T>

Source§

fn sub_assign(&mut self, val: T)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for NativeAtomicElement<T>

§

impl<T> !UnwindSafe for NativeAtomicElement<T>

§

impl<T> Freeze for NativeAtomicElement<T>

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for NativeAtomicElement<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, U> AsyncTeamInto<U> for T
where T: Send, U: AsyncTeamFrom<T>,

Source§

fn team_into<'life0, 'async_trait>( self, team: &'life0 Arc<LamellarTeam>, ) -> Pin<Box<dyn Future<Output = U> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

converts this type into the (usually inferred) input type
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SyncSend for T
where T: Sync + Send,

Source§

impl<T, U> TeamInto<U> for T
where U: TeamFrom<T>,

Source§

fn team_into(self, team: &Arc<LamellarTeam>) -> U

converts this type into the (usually inferred) input type
Source§

impl<T, U> TeamTryInto<U> for T
where U: TeamTryFrom<T>,

Source§

fn team_try_into(self, team: &Arc<LamellarTeam>) -> Result<U, Error>

Trys to convert this type into the (usually inferred) input type
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V