Struct atom::Atom
[−]
[src]
pub struct Atom<P> where
P: IntoRawPtr + FromRawPtr, { /* fields omitted */ }
An Atom wraps an AtomicPtr, it allows for safe mutation of an atomic into common Rust Types.
Methods
impl<P> Atom<P> where
P: IntoRawPtr + FromRawPtr,
[src]
P: IntoRawPtr + FromRawPtr,
pub fn empty() -> Atom<P>
[src]
Create a empty Atom
pub fn new(value: P) -> Atom<P>
[src]
Create a new Atomic from Pointer P
pub fn swap(&self, v: P) -> Option<P>
[src]
Swap a new value into the Atom, This will try multiple times until it succeeds. The old value will be returned.
pub fn take(&self) -> Option<P>
[src]
Take the value of the Atom replacing it with null pointer
Returning the contents. If the contents was a null
pointer the
result will be None
.
pub fn set_if_none(&self, v: P) -> Option<P>
[src]
This will do a CAS
setting the value only if it is NULL
this will return None
if the value was written,
otherwise a Some(v)
will be returned, where the value was
the same value that you passed into this function
pub fn replace_and_set_next(&self, value: P) -> bool where
P: GetNextMut<NextPtr = Option<P>>,
[src]
P: GetNextMut<NextPtr = Option<P>>,
Take the current content, write it into P then do a CAS to extent this Atom with the previous contents. This can be used to create a LIFO
Returns true if this set this migrated the Atom from null.
pub fn is_none(&self) -> bool
[src]
Check to see if an atom is None
This only means that the contents was None when it was measured
Trait Implementations
impl<P> Debug for Atom<P> where
P: IntoRawPtr + FromRawPtr,
[src]
P: IntoRawPtr + FromRawPtr,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl<P> Drop for Atom<P> where
P: IntoRawPtr + FromRawPtr,
[src]
P: IntoRawPtr + FromRawPtr,
impl<P> Send for Atom<P> where
P: IntoRawPtr + FromRawPtr,
[src]
P: IntoRawPtr + FromRawPtr,
impl<P> Sync for Atom<P> where
P: IntoRawPtr + FromRawPtr,
[src]
P: IntoRawPtr + FromRawPtr,