[−][src]Trait radium::RadiumU64
A maybe-atomic shared mutable u64
.
This trait is implemented by both AtomicU64
and
Cell<u64>
, providing a consistent
interface for interacting with the two types.
Required methods
fn new(v: u64) -> Self
Creates a new value of this type.
fn fence(order: Ordering)
If the underlying value is atomic, calls fence
with the given
Ordering
. Otherwise, does nothing.
See also: fence
fn get_mut(&mut self) -> &mut u64
Returns a mutable reference to the underlying value.
This is safe because the mutable reference guarantees that no other references exist to this value.
fn into_inner(self) -> u64
Consumes and returns the contained value.
This is safe as passing by value ensures no other references exist.
fn load(&self, order: Ordering) -> u64
Load a value from this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::load
fn store(&self, val: u64, order: Ordering)
Store a value in this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::store
fn swap(&self, val: u64, order: Ordering) -> u64
Swap with the value stored in this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::swap
fn compare_and_swap(&self, current: u64, new: u64, order: Ordering) -> u64
Stores a value into this object if the current value is the
same as the current
value.
The return value is always the previous value. If it is equal to current
, then
the value was updated.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::compare_and_swap
fn compare_exchange(
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
Stores a value into this object 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
.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::compare_exchange
fn compare_exchange_weak(
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
Stores a value into this object if the current 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 previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::compare_exchange_weak
fn fetch_and(&self, val: u64, order: Ordering) -> u64
Performs a bitwise "and" on the current value and the
argument val
, snd sets the new value to the result.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_and
fn fetch_nand(&self, val: u64, order: Ordering) -> u64
Performs a bitwise "nand" on the current value and the
argument val
, snd sets the new value to the result.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_nand
fn fetch_or(&self, val: u64, order: Ordering) -> u64
Performs a bitwise "or" on the current value and the
argument val
, snd sets the new value to the result.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_or
fn fetch_xor(&self, val: u64, order: Ordering) -> u64
Performs a bitwise "xor" on the current value and the
argument val
, snd sets the new value to the result.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_xor
fn fetch_add(&self, val: u64, order: Ordering) -> u64
Increments the current value by val
, wrapping on overflow.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_add
fn fetch_sub(&self, val: u64, order: Ordering) -> u64
Decrements the current value by val
, wrapping on overflow.
Returns the previous value.
Ordering arguments are ignored by non-atomic types.
See also: AtomicU64::fetch_sub
Implementations on Foreign Types
impl RadiumU64 for AtomicU64
[src]
fn new(v: u64) -> Self
[src]
fn fence(order: Ordering)
[src]
fn get_mut(&mut self) -> &mut u64
[src]
fn into_inner(self) -> u64
[src]
fn load(&self, order: Ordering) -> u64
[src]
fn store(&self, val: u64, order: Ordering)
[src]
fn swap(&self, val: u64, order: Ordering) -> u64
[src]
fn compare_and_swap(&self, current: u64, new: u64, order: Ordering) -> u64
[src]
fn compare_exchange(
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
[src]
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
fn compare_exchange_weak(
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
[src]
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
fn fetch_and(&self, val: u64, order: Ordering) -> u64
[src]
fn fetch_nand(&self, val: u64, order: Ordering) -> u64
[src]
fn fetch_or(&self, val: u64, order: Ordering) -> u64
[src]
fn fetch_xor(&self, val: u64, order: Ordering) -> u64
[src]
fn fetch_add(&self, val: u64, order: Ordering) -> u64
[src]
fn fetch_sub(&self, val: u64, order: Ordering) -> u64
[src]
impl RadiumU64 for Cell<u64>
[src]
fn new(v: u64) -> Self
[src]
fn fence(_order: Ordering)
[src]
fn get_mut(&mut self) -> &mut u64
[src]
fn into_inner(self) -> u64
[src]
fn load(&self, _order: Ordering) -> u64
[src]
fn store(&self, val: u64, _order: Ordering)
[src]
fn swap(&self, val: u64, _order: Ordering) -> u64
[src]
fn compare_and_swap(&self, current: u64, new: u64, _order: Ordering) -> u64
[src]
fn compare_exchange(
&self,
current: u64,
new: u64,
_success: Ordering,
_failure: Ordering
) -> Result<u64, u64>
[src]
&self,
current: u64,
new: u64,
_success: Ordering,
_failure: Ordering
) -> Result<u64, u64>
fn compare_exchange_weak(
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>
[src]
&self,
current: u64,
new: u64,
success: Ordering,
failure: Ordering
) -> Result<u64, u64>