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.
impl<T: Send> Sync for AtomicTake<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicTake<T>
impl<T> !RefUnwindSafe for AtomicTake<T>
impl<T> Send for AtomicTake<T>where
T: Send,
impl<T> Unpin for AtomicTake<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicTake<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more