Skip to main content

AtomicNumber

Struct AtomicNumber 

Source
pub struct AtomicNumber<P: PrimitiveAtomicNumber + Send> { /* private fields */ }

Implementations§

Source§

impl<A> AtomicNumber<A>

Source

pub fn into_atomic_float(self) -> impl AtomicFloat<<Self as Atomic>::Type>

Source§

impl<A> AtomicNumber<A>

Source

pub fn into_atomic_integer(self) -> impl AtomicInteger<<Self as Atomic>::Type>

Trait Implementations§

Source§

impl<T> Add for AtomicNumber<T>
where T: PrimitiveAtomicInteger + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_add(&self, val: Self::Type, order: Ordering) -> Self::Type

Adds to the current value, returning the previous value. Read more
Source§

impl<T> And for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

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

Bitwise “and” with the current value. Read more
Source§

impl<T> AsPtr for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

fn as_ptr(&self) -> *mut T

Returns a mutable pointer to the underlying type. Read more
Source§

impl<T> Atomic for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn new(number: T) -> Self

Creates a new atomic type.
Source§

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

Returns a mutable reference to the underlying type. Read more
Source§

fn into_inner(self) -> T

Consumes the atomic and returns the contained value. Read more
Source§

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

Loads a value from the atomic type. Read more
Source§

fn store(&self, value: T, ordering: Ordering)

Stores a value into the atomic type. Read more
Source§

fn swap(&self, new_value: T, ordering: Ordering) -> T

Stores a value into the atomic type, returning the previous value. Read more
Source§

fn compare_and_swap(&self, current: T, new: T, order: Ordering) -> T

👎Deprecated:

Use compare_exchange or compare_exchange_weak instead

Stores a value into the atomic type if the current value is the same as the current value. Read more
Source§

fn compare_exchange( &self, current: T, new: T, success: Ordering, failure: Ordering, ) -> Result<T, T>

Stores a value into the atomic type if the current value is the same as the current value. Read more
Source§

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

Stores a value into the atomic type if the current value is the same as the current value. Read more
Source§

impl<T> Bitwise for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

impl<T> Debug for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

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

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

impl<T> Default for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

fn default() -> Self

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

impl<T> FromPtr for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

unsafe fn from_ptr<'a>(ptr: *mut T) -> &'a Self

Creates a new atomic type from a pointer. Read more
Source§

impl<T> Max for AtomicNumber<T>
where T: PrimitiveAtomicInteger + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_max(&self, val: Self::Type, order: Ordering) -> T

Maximum with the current value. Read more
Source§

impl<T> Min for AtomicNumber<T>
where T: PrimitiveAtomicInteger + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_min(&self, val: Self::Type, order: Ordering) -> Self::Type

Minimum with the current value. Read more
Source§

impl<T> Nand for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_nand(&self, val: T, order: Ordering) -> T

Bitwise “nand” with the current value. Read more
Source§

impl<T> NumOps for AtomicNumber<T>
where T: PrimitiveAtomicInteger + FromPrimitive,

Source§

impl<T> Or for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

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

Bitwise “or” with the current value. Read more
Source§

impl<F: PrimitiveAtomicNumber> Send for AtomicNumber<F>

Source§

impl<T> Sub for AtomicNumber<T>
where T: PrimitiveAtomicInteger + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_sub(&self, val: Self::Type, order: Ordering) -> Self::Type

Subtracts from the current value, returning the previous value. Read more
Source§

impl<F: PrimitiveAtomicNumber> Sync for AtomicNumber<F>

Source§

impl<T> Update for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

fn fetch_update<F>( &self, set_order: Ordering, fetch_order: Ordering, update: F, ) -> Result<T, T>
where F: FnMut(T) -> Option<T>,

Fetches the value, and applies a function to it that returns an optional new value. Read more
Source§

impl<T> UseUpdateToAdd for AtomicNumber<T>
where T: PrimitiveAtomicFloat + FromPrimitive,

Source§

type Type = T

Source§

fn fetch_add_via_update(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl<T> UseUpdateToMax for AtomicNumber<T>
where T: PrimitiveAtomicFloat + FromPrimitive,

Source§

type Type = T

Source§

fn fetch_max_via_update(&self, val: Self::Type, order: Ordering) -> T

Source§

impl<T> UseUpdateToMin for AtomicNumber<T>
where T: PrimitiveAtomicFloat + FromPrimitive,

Source§

type Type = T

Source§

fn fetch_min_via_update(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl<T> UseUpdateToSub for AtomicNumber<T>
where T: PrimitiveAtomicFloat + FromPrimitive,

Source§

type Type = T

Source§

fn fetch_sub_via_update(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl<T> Xor for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,

Source§

type Type = T

The underlying type
Source§

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

Bitwise “xor” with the current value. Read more

Auto Trait Implementations§

§

impl<P> Freeze for AtomicNumber<P>
where <P as FromStr>::Err: Sized, <P as IntoAtomicNumber>::AN: Freeze,

§

impl<P> RefUnwindSafe for AtomicNumber<P>
where <P as FromStr>::Err: Sized, <P as IntoAtomicNumber>::AN: RefUnwindSafe,

§

impl<P> Unpin for AtomicNumber<P>
where <P as FromStr>::Err: Sized, <P as IntoAtomicNumber>::AN: Unpin,

§

impl<P> UnsafeUnpin for AtomicNumber<P>
where <P as FromStr>::Err: Sized, <P as IntoAtomicNumber>::AN: UnsafeUnpin,

§

impl<P> UnwindSafe for AtomicNumber<P>
where <P as FromStr>::Err: Sized, <P as IntoAtomicNumber>::AN: UnwindSafe,

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<AF, F> AtomicFloat<F> for AF
where AF: Abs<Type = F> + Atomic<Type = F> + Neg<Type = F> + UseUpdateToAdd<Type = F> + Bitwise + UseUpdateToSub<Type = F> + AsPtr + UseUpdateToMin<Type = F> + Update<Type = F> + UseUpdateToMax<Type = F> + Send + Sync, F: PrimitiveFloat,

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> 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 = !

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

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

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.