[−][src]Trait radium::RadiumPtr
A maybe-atomic shared mutable *mut T
.
This trait is implemented by both AtomicPtr<T>
and
Cell<*mut T>
, providing a consistent interface for interacting
with the two types.
Required methods
fn new(v: *mut T) -> 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 *mut T
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) -> *mut T
Consumes and returns the contained value.
This is safe as passing by value ensures no other references exist.
fn load(&self, order: Ordering) -> *mut T
Load a value from this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicPtr::load
fn store(&self, val: *mut T, order: Ordering)
Store a value in this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicPtr::store
fn swap(&self, val: *mut T, order: Ordering) -> *mut T
Swap with the value stored in this object.
Ordering arguments are ignored by non-atomic types.
See also: AtomicPtr::swap
fn compare_and_swap(
&self,
current: *mut T,
new: *mut T,
order: Ordering
) -> *mut T
&self,
current: *mut T,
new: *mut T,
order: Ordering
) -> *mut T
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: AtomicPtr::compare_and_swap
fn compare_exchange(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
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: AtomicPtr::compare_exchange
fn compare_exchange_weak(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
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: AtomicPtr::compare_exchange_weak
Implementations on Foreign Types
impl<T> RadiumPtr<T> for AtomicPtr<T>
[src]
fn new(v: *mut T) -> Self
[src]
fn fence(order: Ordering)
[src]
fn get_mut(&mut self) -> &mut *mut T
[src]
fn into_inner(self) -> *mut T
[src]
fn load(&self, order: Ordering) -> *mut T
[src]
fn store(&self, val: *mut T, order: Ordering)
[src]
fn swap(&self, val: *mut T, order: Ordering) -> *mut T
[src]
fn compare_and_swap(
&self,
current: *mut T,
new: *mut T,
order: Ordering
) -> *mut T
[src]
&self,
current: *mut T,
new: *mut T,
order: Ordering
) -> *mut T
fn compare_exchange(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
[src]
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
fn compare_exchange_weak(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
[src]
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
impl<T> RadiumPtr<T> for Cell<*mut T>
[src]
fn new(v: *mut T) -> Self
[src]
fn fence(_order: Ordering)
[src]
fn get_mut(&mut self) -> &mut *mut T
[src]
fn into_inner(self) -> *mut T
[src]
fn load(&self, _order: Ordering) -> *mut T
[src]
fn store(&self, val: *mut T, _order: Ordering)
[src]
fn swap(&self, val: *mut T, _order: Ordering) -> *mut T
[src]
fn compare_and_swap(
&self,
current: *mut T,
new: *mut T,
_order: Ordering
) -> *mut T
[src]
&self,
current: *mut T,
new: *mut T,
_order: Ordering
) -> *mut T
fn compare_exchange(
&self,
current: *mut T,
new: *mut T,
_success: Ordering,
_failure: Ordering
) -> Result<*mut T, *mut T>
[src]
&self,
current: *mut T,
new: *mut T,
_success: Ordering,
_failure: Ordering
) -> Result<*mut T, *mut T>
fn compare_exchange_weak(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>
[src]
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering
) -> Result<*mut T, *mut T>