#[repr(transparent)]pub struct Take<C>(pub C);
Expand description
Used to remove the value of a cell. Can be constructed directly or with AsyncCell::take.
Note that a single instance of Take
can be used multiple times to
consume a sequence of values. For example:
use async_cell::unsync::AsyncCell;
let cell = AsyncCell::new();
let taker = cell.take();
cell.set(1);
assert_eq!(taker.await, 1);
cell.set(2);
assert_eq!(taker.await, 2);
Tuple Fields§
§0: C
Trait Implementations§
impl<C: Copy> Copy for Take<C>
Auto Trait Implementations§
impl<C> Freeze for Take<C>where
C: Freeze,
impl<C> RefUnwindSafe for Take<C>where
C: RefUnwindSafe,
impl<C> Send for Take<C>where
C: Send,
impl<C> Sync for Take<C>where
C: Sync,
impl<C> Unpin for Take<C>where
C: Unpin,
impl<C> UnwindSafe for Take<C>where
C: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more