Trait fuchsia_async::TimeoutExt
source · pub trait TimeoutExt: Future + Sized {
// Provided methods
fn on_timeout<WT, OT>(self, time: WT, on_timeout: OT) -> OnTimeout<Self, OT> ⓘ
where WT: WakeupTime,
OT: FnOnce() -> Self::Output { ... }
fn on_stalled<OS>(
self,
timeout: Duration,
on_stalled: OS,
) -> OnStalled<Self, OS> ⓘ
where OS: FnOnce() -> Self::Output { ... }
}
Expand description
A trait which allows futures to be easily wrapped in a timeout.
Provided Methods§
sourcefn on_timeout<WT, OT>(self, time: WT, on_timeout: OT) -> OnTimeout<Self, OT> ⓘ
fn on_timeout<WT, OT>(self, time: WT, on_timeout: OT) -> OnTimeout<Self, OT> ⓘ
Wraps the future in a timeout, calling on_timeout
to produce a result
when the timeout occurs.
sourcefn on_stalled<OS>(
self,
timeout: Duration,
on_stalled: OS,
) -> OnStalled<Self, OS> ⓘ
fn on_stalled<OS>( self, timeout: Duration, on_stalled: OS, ) -> OnStalled<Self, OS> ⓘ
Wraps the future in a stall-guard, calling on_stalled
to produce a result
when the future hasn’t been otherwise polled within the timeout
.
This is a heuristic - spurious wakeups will keep the detection from triggering,
and moving all work to external tasks or threads with force the triggering early.
Object Safety§
This trait is not object safe.