Struct atom::Atom

source · []
pub struct Atom<P> where
    P: IntoRawPtr + FromRawPtr
{ /* private fields */ }
Expand description

An Atom wraps an AtomicPtr, it allows for safe mutation of an atomic into common Rust Types.

Implementations

Create a empty Atom

Create a new Atomic from Pointer P

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

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.

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

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.

Check to see if an atom is None

This only means that the contents was None when it was measured

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.