Struct atomic_take::AtomicTake
source · pub struct AtomicTake<T> { /* private fields */ }
Expand description
A container with an atomic take operation.
Implementations§
source§impl<T> AtomicTake<T>
impl<T> AtomicTake<T>
sourcepub fn take(&self) -> Option<T>
pub fn take(&self) -> Option<T>
Takes out the value from this AtomicTake
. It is guaranteed that exactly one
caller will receive the value and all others will receive None
.
sourcepub fn take_mut(&mut self) -> Option<T>
pub fn take_mut(&mut self) -> Option<T>
This methods does the same as take
, but does not use an atomic swap.
This is safe because you cannot call this method without unique access to the
AtomicTake
, so no other threads will try to take it concurrently.
Trait Implementations§
source§impl<T> Debug for AtomicTake<T>
impl<T> Debug for AtomicTake<T>
source§impl<T> Drop for AtomicTake<T>
impl<T> Drop for AtomicTake<T>
source§impl<T> From<T> for AtomicTake<T>
impl<T> From<T> for AtomicTake<T>
source§fn from(t: T) -> AtomicTake<T>
fn from(t: T) -> AtomicTake<T>
Converts to this type from the input type.