[−][src]Struct arae::AtomicCursor
An atomic wrapper around a Cursor
.
Methods
impl<T> AtomicCursor<T>
[src]
pub fn new(cursor: Cursor<T>) -> Self
[src]
Constructs new atomic cursor given a Cursor
.
pub fn load(&self, order: Ordering) -> Cursor<T>
[src]
Loads a Cursor
value.
load
takes an Ordering
argument which describes the memory ordering
of this operation. Possible values are SeqCst
, Acquire
and Relaxed
.
Panics
Panics if order
is Release
or AcqRel
.
pub fn store(&self, cursor: Cursor<T>, order: Ordering)
[src]
Stores a Cursor
value.
store
takes an Ordering
argument which describes the memory ordering
of this operation. Possible values are SeqCst
, Release
and Relaxed
.
Panics
Panics if order
is Acquire
or AcqRel
.
pub fn swap(&self, cursor: Cursor<T>, order: Ordering) -> Cursor<T>
[src]
Stores a Cursor
value, returning the previous value.
swap
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
pub fn compare_and_swap(
&self,
current: Cursor<T>,
new: Cursor<T>,
order: Ordering
) -> Cursor<T>
[src]
&self,
current: Cursor<T>,
new: Cursor<T>,
order: Ordering
) -> Cursor<T>
Stores a Cursor
value 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.
compare_and_swap
also takes an Ordering
argument which describes the memory
ordering of this operation. Notice that even when using AcqRel
, the operation
might fail and hence just perform an Acquire
load, but not have Release
semantics.
Using Acquire
makes the store part of this operation Relaxed
if it
happens, and using Release
makes the load part Relaxed
.
pub fn compare_exchange(
&self,
current: Cursor<T>,
new: Cursor<T>,
success: Ordering,
failure: Ordering
) -> Result<Cursor<T>, Cursor<T>>
[src]
&self,
current: Cursor<T>,
new: Cursor<T>,
success: Ordering,
failure: Ordering
) -> Result<Cursor<T>, Cursor<T>>
Stores a Cursor
value 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
.
compare_exchange
takes two Ordering
arguments to describe the memory
ordering of this operation. The first describes the required ordering if the
operation succeeds while the second describes the required ordering when the
operation fails. Using Acquire
as success ordering makes the store part
of this operation Relaxed
, and using Release
makes the successful load
Relaxed
. The failure ordering can only be SeqCst
, Acquire
or Relaxed
and must be equivalent to or weaker than the success ordering.
pub fn compare_exchange_weak(
&self,
current: Cursor<T>,
new: Cursor<T>,
success: Ordering,
failure: Ordering
) -> Result<Cursor<T>, Cursor<T>>
[src]
&self,
current: Cursor<T>,
new: Cursor<T>,
success: Ordering,
failure: Ordering
) -> Result<Cursor<T>, Cursor<T>>
Stores a Cursor
value 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.
compare_exchange_weak
takes two Ordering
arguments to describe the memory
ordering of this operation. The first describes the required ordering if the
operation succeeds while the second describes the required ordering when the
operation fails. Using Acquire
as success ordering makes the store part
of this operation Relaxed
, and using Release
makes the successful load
Relaxed
. The failure ordering can only be SeqCst
, Acquire
or Relaxed
and must be equivalent to or weaker than the success ordering.
pub fn next<C>(&self, cursed: &C, order: Ordering) -> bool where
C: Sequence<T>,
[src]
C: Sequence<T>,
Atomically advance the cursor given its owner.
next
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
Returns true
if the cursor was updated, false
if the cursor is at the
tail and cannot go forward any further.
Panics
Panics if cursed
does not own the cursor.
pub fn prev<C>(&self, cursed: &C, order: Ordering) -> bool where
C: Sequence<T>,
[src]
C: Sequence<T>,
Atomically reverse the cursor given its owner.
prev
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
Returns true
if the cursor was updated, false
if the cursor is at the
head and cannot go back any further.
Panics
Panics if cursed
does not own the cursor.
pub fn wrapping_next<C>(&self, cursed: &C, order: Ordering) where
C: Bounded<T>,
[src]
C: Bounded<T>,
Atomically advance the cursor given its owner.
next
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
Panics
Panics if cursed
does not own the cursor.
pub fn wrapping_prev<C>(&self, cursed: &C, order: Ordering) where
C: Bounded<T>,
[src]
C: Bounded<T>,
Atomically reverse the cursor given its owner.
prev
takes an Ordering
argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire
makes the store part of this operation Relaxed
, and
using Release
makes the load part Relaxed
.
Panics
Panics if the cursed
does not own the cursor.
pub fn into_cursor(self) -> Cursor<T>
[src]
Converts the atomic cursor into the base variant.
Trait Implementations
impl<T: Debug> Debug for AtomicCursor<T>
[src]
impl<T> From<AtomicCursor<T>> for Cursor<T>
[src]
fn from(cursor: AtomicCursor<T>) -> Self
[src]
impl<T> From<Cursor<T>> for AtomicCursor<T>
[src]
Auto Trait Implementations
impl<T> Send for AtomicCursor<T> where
T: Send,
T: Send,
impl<T> Sync for AtomicCursor<T> where
T: Sync,
T: Sync,
impl<T> Unpin for AtomicCursor<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,