Struct std::sync::atomics::AtomicOption[src]
pub struct AtomicOption<T> {
// some fields omitted
}An atomic, nullable unique pointer
This can be used as the concurrency primitive for operations that transfer owned heap objects across tasks.
Methods
impl<T> AtomicOption<T>
fn new<T>(p: Box) -> AtomicOption<T>
Create a new AtomicOption
fn empty<T>() -> AtomicOption<T>
Create a new AtomicOption that doesn't contain a value
fn swap<T>(&self, val: Box, order: Ordering) -> Option<Box>
Store a value, returning the old value
fn take<T>(&self, order: Ordering) -> Option<Box>
Remove the value, leaving the AtomicOption empty.
fn fill<T>(&self, val: Box, order: Ordering) -> Option<Box>
Replace an empty value with a non-empty value.
Succeeds if the option is None and returns None if so. If
the option was already Some, returns Some of the rejected
value.
fn is_empty<T>(&self, order: Ordering) -> bool
Returns true if the AtomicOption is empty.
Be careful: The caller must have some external method of ensuring the result does not get invalidated by another task after this returns.