Struct atomic_take::AtomicTake

source ·
pub struct AtomicTake<T> { /* private fields */ }
Expand description

A container with an atomic take operation.

Implementations§

Create a new AtomicTake with the given value.

Create an empty AtomicTake that contains no value.

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

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.

Check whether the value is taken. Note that if this returns false, then this is immediately stale if another thread could be concurrently trying to take it.

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§

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Converts to this type from the input type.

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
Converts to this type from the input type.

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.