[go: up one dir, main page]

Struct atom::AtomSetOnce [] [src]

pub struct AtomSetOnce<P> where P: IntoRawPtr + FromRawPtr {
    // some fields omitted
}

This is a restricted version of the Atom. It allows for only set_if_none to be called.

swap and take can be used only with a mutable reference. Meaning that AtomSetOnce is not usable as a

Methods

impl<P> AtomSetOnce<P> where P: IntoRawPtr + FromRawPtr
[src]

fn empty() -> AtomSetOnce<P>

Create a empty AtomSetOnce

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

Create a new AtomSetOnce from Pointer P

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 OK(()) if the value was written, otherwise a Err(P) will be returned, where the value was the same value that you passed into this function

fn into_atom(self) -> Atom<P>

Convert an AtomSetOnce into an Atom

fn atom(&mut self) -> &mut Atom<P>

Allow access to the atom if exclusive access is granted

impl<T, P> AtomSetOnce<P> where P: IntoRawPtr + FromRawPtr + Deref<Target=T>
[src]

fn get<'a>(&'a self) -> Option<&'a T>

If the Atom is set, get the value

impl<T> AtomSetOnce<Box<T>>
[src]

fn get_mut<'a>(&'a mut self) -> Option<&'a mut T>

If the Atom is set, get the value

impl<T> AtomSetOnce<Arc<T>>
[src]

fn dup<'a>(&self) -> Option<Arc<T>>

Duplicate the inner pointer if it is set

Trait Implementations

impl<P: Debug> Debug for AtomSetOnce<P> where P: IntoRawPtr + FromRawPtr
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.