[][src]Struct atomic_take::AtomicTake

pub struct AtomicTake<T> { /* fields omitted */ }

A container with an atomic take operation.

Methods

impl<T> AtomicTake<T>[src]

pub fn new(value: T) -> Self[src]

Create a new AtomicTake with the given value.

pub fn take(&self) -> Option<T>[src]

Takes out the value from this AtomicTake. It is guaranteed that exactly one caller will receive the value and all others will receive None.

pub fn take_mut(&mut self) -> Option<T>[src]

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.

pub fn insert(&mut self, value: T) -> Option<T>[src]

Insert a new value into the AtomicTake and return the previous value.

This function requires unique access to ensure no other threads accesses the AtomicTake concurrently, as this operation cannot be performed atomically without a lock.

Trait Implementations

impl<T> Drop for AtomicTake<T>[src]

impl<T: Send> Sync for AtomicTake<T>[src]

Auto Trait Implementations

impl<T> Unpin for AtomicTake<T> where
    T: Unpin

impl<T> Send for AtomicTake<T> where
    T: Send

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]