named_timer

Trait NamedTimeoutExt

Source
pub trait NamedTimeoutExt: Future + Sized {
    // Provided method
    fn on_timeout_named<OT>(
        self,
        id: &DeadlineId<'_>,
        duration: MonotonicDuration,
        on_timeout: OT,
    ) -> OnTimeout<Self, OT>
       where OT: FnOnce() -> Self::Output { ... }
}
Expand description

An extension trait that allows setting a timeout with an associated name. The timeout is intended to be used in conjunction with the fake-clock library. Under normal execution, this behaves identically to [fuchsia_async::TimeoutExt]. When run in an integration test with the fake-clock library linked in, the creation of the timer and the expiration of the timer are reported to the fake-clock service. The integration test may register interest in these events to stop time when they occur.

Provided Methods§

Source

fn on_timeout_named<OT>( self, id: &DeadlineId<'_>, duration: MonotonicDuration, on_timeout: OT, ) -> OnTimeout<Self, OT>
where OT: FnOnce() -> Self::Output,

Wraps the future in a timeout, calling on_timeout when the timeout occurs. In an integration test, the SET event is reported immediately when this method is called, and EXPIRED is reported after duration elapses. Note EXPIRED is still reported even if on_timeout is not run.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§