Trait wasm_timer::TryStreamExt
source · pub trait TryStreamExt: TryStream + Sized {
// Provided method
fn timeout(self, dur: Duration) -> TimeoutStream<Self>
where Self::Error: From<Error> { ... }
}
Expand description
An extension trait for streams which provides convenient accessors for timing out execution and such.
Provided Methods§
sourcefn timeout(self, dur: Duration) -> TimeoutStream<Self>
fn timeout(self, dur: Duration) -> TimeoutStream<Self>
Creates a new stream which will take at most dur
time to yield each
item of the stream.
This combinator creates a new stream which wraps the receiving stream
in a timeout-per-item. The stream returned will resolve in at most
dur
time for each item yielded from the stream. The first item’s timer
starts when this method is called.
If a stream’s item completes before dur
elapses then the timer will be
reset for the next item. If the timeout elapses, however, then an error
will be yielded on the stream and the timer will be reset.
Object Safety§
This trait is not object safe.