[−][src]Trait atomic_traits::Atomic
Generic atomic types
Associated Types
type Type
The underlying type
Required methods
fn new(v: Self::Type) -> Self
Creates a new atomic type.
fn get_mut(&mut self) -> &mut Self::Type
Returns a mutable reference to the underlying type.
fn into_inner(self) -> Self::Type
Consumes the atomic and returns the contained value.
fn load(&self, order: Ordering) -> Self::Type
Loads a value from the atomic type.
fn store(&self, val: Self::Type, order: Ordering)
Stores a value into the atomic type.
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
Stores a value into the atomic type, returning the previous value.
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
Stores a value into the atomic type 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.
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
Stores a value into the atomic type 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
.
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
Stores a value into the atomic type 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.
Implementations on Foreign Types
impl Atomic for AtomicBool
[src]
type Type = bool
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicIsize
[src]
type Type = isize
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicUsize
[src]
type Type = usize
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl<T> Atomic for AtomicPtr<T>
[src]
type Type = *mut T
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicI8
[src]
type Type = i8
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicI16
[src]
type Type = i16
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicI32
[src]
type Type = i32
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicI64
[src]
type Type = i64
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicU8
[src]
type Type = u8
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicU16
[src]
type Type = u16
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicU32
[src]
type Type = u32
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
impl Atomic for AtomicU64
[src]
type Type = u64
fn new(v: Self::Type) -> Self
[src]
fn get_mut(&mut self) -> &mut Self::Type
[src]
fn into_inner(self) -> Self::Type
[src]
fn load(&self, order: Ordering) -> Self::Type
[src]
fn store(&self, val: Self::Type, order: Ordering)
[src]
fn swap(&self, val: Self::Type, order: Ordering) -> Self::Type
[src]
fn compare_and_swap(
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
[src]
&self,
current: Self::Type,
new: Self::Type,
order: Ordering
) -> Self::Type
fn compare_exchange(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
fn compare_exchange_weak(
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>
[src]
&self,
current: Self::Type,
new: Self::Type,
success: Ordering,
failure: Ordering
) -> Result<Self::Type, Self::Type>