pub trait Radium {
    type Item;
Show 16 methods fn new(value: Self::Item) -> Self;
fn fence(order: Ordering);
fn get_mut(&mut self) -> &mut Self::Item;
fn into_inner(self) -> Self::Item;
fn load(&self, order: Ordering) -> Self::Item;
fn store(&self, value: Self::Item, order: Ordering);
fn swap(&self, value: Self::Item, order: Ordering) -> Self::Item;
fn compare_and_swap(
        &self,
        current: Self::Item,
        new: Self::Item,
        order: Ordering
    ) -> Self::Item;
fn compare_exchange(
        &self,
        current: Self::Item,
        new: Self::Item,
        success: Ordering,
        failure: Ordering
    ) -> Result<Self::Item, Self::Item>;
fn compare_exchange_weak(
        &self,
        current: Self::Item,
        new: Self::Item,
        success: Ordering,
        failure: Ordering
    ) -> Result<Self::Item, Self::Item>;
fn fetch_and(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: BitOps
;
fn fetch_nand(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: BitOps
;
fn fetch_or(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: BitOps
;
fn fetch_xor(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: BitOps
;
fn fetch_add(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: NumericOps
;
fn fetch_sub(&self, value: Self::Item, order: Ordering) -> Self::Item
    where
        Self::Item: NumericOps
;
}
Expand description

A maybe-atomic shared mutable fundamental type T.

This trait is implemented by both the atomic wrapper type for T, and by Cell<T>, providing a consistent interface for interacting with the two types.

This trait provides methods predicated on marker traits for the underlying fundamental. Only types which can be viewed as sequences of bits may use the functions for bit-wise arithmetic, and only types which can be used as integers may use the functions for numeric arithmetic. Use of these methods on insufficient underlying types (for example, Radium::fetch_and on an atomic or cell-wrapped pointer) will cause a compiler error.

Associated Types

Required methods

Creates a new value of this type.

If the underlying value is atomic, calls fence with the given Ordering. Otherwise, does nothing.

Returns a mutable reference to the underlying value.

This is safe because the mutable reference to self guarantees that no other references exist to this value.

Consumes the wrapper and returns the contained value.

This is safe as passing by value ensures no other references exist.

Load a value from this object.

Ordering values are ignored by non-atomic types.

See also: AtomicUsize::load.

Store a value in this object.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::store.

Swap with the value stored in this object.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::swap.

Stores a value into this object if the currently-stored value is the same as the current value.

The return value is always the previously-stored value. If it is equal to current, then the value was updated with new.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::compare_and_swap.

Stores a value into this object if the currently-stored value is the same as the current value.

The return value is a Result indicating whether the new value was written, and containing the previously-stored value. On success, this value is guaranteed to be equal to current.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::compare_exchange.

Stores a value into this object if the currently-stored value is the same as the current value.

Unlike compare_exchange, this function is allowed to spuriously fail even when the comparison succeeds, which can result in more efficient code on some platforms. The return value is a Result indicating whether the new value was written, and containing the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::compare_exchange_weak.

Performs a bitwise “and” on the currently-stored value and the argument value, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_and.

Performs a bitwise “nand” on the currently-stored value and the argument value, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_nand.

Performs a bitwise “or” on the currently-stored value and the argument value, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_or.

Performs a bitwise “xor” on the currently-stored value and the argument value, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_xor.

Adds value to the currently-stored value, wrapping on overflow, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_add.

Subtracts value from the currently-stored value, wrapping on underflow, and stores the result in self.

Returns the previously-stored value.

Ordering arguments are ignored by non-atomic types.

See also: AtomicUsize::fetch_sub.

Implementations on Foreign Types

Implementors