[go: up one dir, main page]

Struct atom::Atom [] [src]

pub struct Atom<P> where P: IntoRawPtr + FromRawPtr {
    // some 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]

fn empty() -> Atom<P>

Create a empty Atom

fn new(value: P) -> Atom<P>

Create a new Atomic from Pointer P

fn swap(&self, v: P) -> Option<P>

Swap a new value into the Atom, This will try multiple times until it succeeds. The old value will be returned.

fn take(&self) -> Option<P>

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.

fn set_if_none(&self, v: P) -> Option<P>

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

fn replace_and_set_next(&self, value: P) -> bool where 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.

fn is_none(&self) -> bool

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]

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.

impl<P> Drop for Atom<P> where P: IntoRawPtr + FromRawPtr
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl<P> Send for Atom<P> where P: IntoRawPtr + FromRawPtr
[src]