TimeoutStreamExt

Trait TimeoutStreamExt 

Source
pub trait TimeoutStreamExt: TryStream {
    // Provided method
    fn forward_to_timeout<S>(
        self,
        sink: S,
    ) -> ForwardWithTimeout<Self, S, Self::Ok> 
       where S: Sink<Self::Ok, Error = SinkTimeoutError<Self::Error>>,
             Self: Sized { ... }
}
Expand description

[futures::TryStream] extension that allows forwarding items to a sink with a timeout while discarding timed out items.

Provided Methods§

Source

fn forward_to_timeout<S>(self, sink: S) -> ForwardWithTimeout<Self, S, Self::Ok>
where S: Sink<Self::Ok, Error = SinkTimeoutError<Self::Error>>, Self: Sized,

Specialization of [StreamExt::forward] for Sinks using the SinkTimeoutError.

If the sink returns SinkTimeoutError::Timeout, the current item from this stream is discarded and the forwarding process continues with the next item until the stream is depleted.

This is in contrast to [StreamExt::forward] which would terminate with SinkTimeoutError::Timeout.

Errors other than SinkTimeoutError::Timeout cause the forwarding to terminate with that error (as in the original behavior of [StreamExt::forward]).

Implementors§

Source§

impl<T> TimeoutStreamExt for T
where T: TryStream + ?Sized,