Struct atom::AtomSetOnce
source · [−]pub struct AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr, { /* private fields */ }
Expand description
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
Implementations
sourceimpl<P> AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr,
impl<P> AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr,
sourcepub fn empty() -> AtomSetOnce<P>
pub fn empty() -> AtomSetOnce<P>
Create an empty AtomSetOnce
sourcepub fn new(value: P) -> AtomSetOnce<P>
pub fn new(value: P) -> AtomSetOnce<P>
Create a new AtomSetOnce
from Pointer P
sourcepub fn set_if_none(&self, v: P, order: Ordering) -> Option<P>
pub fn set_if_none(&self, v: P, order: Ordering) -> 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
sourceimpl<T, P> AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr + Deref<Target = T>,
impl<T, P> AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr + Deref<Target = T>,
sourceimpl<T> AtomSetOnce<Box<T>>
impl<T> AtomSetOnce<Box<T>>
sourceimpl<T> AtomSetOnce<T> where
T: Clone + IntoRawPtr + FromRawPtr,
impl<T> AtomSetOnce<T> where
T: Clone + IntoRawPtr + FromRawPtr,
Trait Implementations
sourceimpl<P: Debug> Debug for AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr,
impl<P: Debug> Debug for AtomSetOnce<P> where
P: IntoRawPtr + FromRawPtr,
Auto Trait Implementations
impl<P> !RefUnwindSafe for AtomSetOnce<P>
impl<P> Send for AtomSetOnce<P> where
P: Send,
impl<P> Sync for AtomSetOnce<P> where
P: Send,
impl<P> Unpin for AtomSetOnce<P> where
P: Unpin,
impl<P> UnwindSafe for AtomSetOnce<P> where
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more