pub struct Ticket<'a, T> { /* private fields */ }Available on crate feature
static-deferred only.Expand description
Permission to run one job for a StaticDeferred, returned by
StaticDeferred::begin.
Pass it to the task that does the work and call run there. Dropping it
without running resets the StaticDeferred to State::NotStarted.
Implementations§
Source§impl<'a, T> Ticket<'a, T>
impl<'a, T> Ticket<'a, T>
Sourcepub async fn run<F>(self, future: F)where
F: Future<Output = T>,
pub async fn run<F>(self, future: F)where
F: Future<Output = T>,
Runs future and makes its output the result of the StaticDeferred.
Returns early, without a result, if the run is cancelled. If the task is dropped while
the job is running, the StaticDeferred reports State::Cancelled. If it is dropped
before the job starts, it counts as a ticket dropped without running: the state goes
back to State::NotStarted.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for Ticket<'a, T>
impl<'a, T> !UnwindSafe for Ticket<'a, T>
impl<'a, T> Forget for Ticket<'a, T>
impl<'a, T> Freeze for Ticket<'a, T>where
&'a StaticDeferred<T>: Freeze,
impl<'a, T> Move for Ticket<'a, T>
impl<'a, T> Send for Ticket<'a, T>where
&'a StaticDeferred<T>: Send,
impl<'a, T> Sync for Ticket<'a, T>where
&'a StaticDeferred<T>: Sync,
impl<'a, T> Unpin for Ticket<'a, T>where
&'a StaticDeferred<T>: Unpin,
impl<'a, T> UnsafeUnpin for Ticket<'a, T>where
&'a StaticDeferred<T>: UnsafeUnpin,
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