pub trait DispatcherTimerExt {
// Required methods
fn after_deadline(&self, deadline: MonotonicInstant) -> AfterDeadline ⓘ;
fn try_after_deadline(
&self,
deadline: MonotonicInstant,
) -> Option<AfterDeadline>;
}Expand description
Implements methods used for setting and waiting on timers on a dispatcher.
Required Methods§
Sourcefn after_deadline(&self, deadline: MonotonicInstant) -> AfterDeadline ⓘ
fn after_deadline(&self, deadline: MonotonicInstant) -> AfterDeadline ⓘ
Returns a future that will fire when after the given deadline time.
This can be used instead of the fuchsia-async timer primitives in situations where there isn’t a currently active fuchsia-async executor running on that dispatcher for some reason (ie. the rust code does not own the dispatcher) or for cases where the small overhead of fuchsia-async compatibility is too much.
§Panics
If the dispatcher pointed to by self is not available right now (like [CurrentDispatcher])
on a thread with no current dispatcher set, this function will panic. You can use
Self::try_after_deadline to handle the condition where there is no current dispatcher,
or if you’re trying to run it on the current dispatcher you may want to use AfterDeadline::new
instead.
Sourcefn try_after_deadline(
&self,
deadline: MonotonicInstant,
) -> Option<AfterDeadline>
fn try_after_deadline( &self, deadline: MonotonicInstant, ) -> Option<AfterDeadline>
Returns a future that will fire when after the given deadline time.
This can be used instead of the fuchsia-async timer primitives in situations where there isn’t a currently active fuchsia-async executor running on that dispatcher for some reason (ie. the rust code does not own the dispatcher) or for cases where the small overhead of fuchsia-async compatibility is too much.