pub struct Done<T: Send + 'static> { /* private fields */ }Expand description
One outstanding completion, handed to an arm. A Rust arm calls Done::complete; a foreign
arm receives Done::token and completes through the generated symbol.
A Done fires at most once: completing consumes it, and a completion arriving after the
token was cancelled or already answered finds nothing and does nothing.
Implementations§
Source§impl<T: Send + 'static> Done<T>
impl<T: Send + 'static> Done<T>
Sourcepub fn new(
registry: &'static Registry<T>,
cb: impl FnOnce(Result<T, Error>) + Send + 'static,
) -> Self
pub fn new( registry: &'static Registry<T>, cb: impl FnOnce(Result<T, Error>) + Send + 'static, ) -> Self
Register cb and produce the handle the arm receives.
Sourcepub fn token(&self) -> u64
pub fn token(&self) -> u64
The number a foreign arm carries and hands back to the completion symbol.
Sourcepub fn into_token(self) -> u64
pub fn into_token(self) -> u64
Hand the token to a foreign arm: the closure stays registered until the generated completion symbol resolves it, or the waiting future is dropped.
Auto Trait Implementations§
impl<T> Forget for Done<T>
impl<T> Freeze for Done<T>
impl<T> Move for Done<T>
impl<T> RefUnwindSafe for Done<T>where
&'static Registry<T>: RefUnwindSafe,
impl<T> Send for Done<T>
impl<T> Sync for Done<T>
impl<T> Unpin for Done<T>
impl<T> UnsafeUnpin for Done<T>where
&'static Registry<T>: UnsafeUnpin,
impl<T> UnwindSafe for Done<T>where
&'static Registry<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