pub trait TimeoutExt<T, R>: Stream<Item = StreamItem<T>> + Sizedwhere
T: Fluxion,
T::Inner: Clone + Debug + Ord + Unpin + Send + Sync + 'static,
T::Timestamp: Debug + Ord + Copy + 'static,
R: Runtime,{
// Required method
fn timeout(
self,
duration: Duration,
) -> impl Stream<Item = StreamItem<T>> + Send + Sync;
}Expand description
Extension trait providing the timeout operator for streams.
This trait allows any stream of StreamItem<T> where T: Fluxion to enforce a timeout
between emissions.
Required Methods§
Sourcefn timeout(
self,
duration: Duration,
) -> impl Stream<Item = StreamItem<T>> + Send + Sync
fn timeout( self, duration: Duration, ) -> impl Stream<Item = StreamItem<T>> + Send + Sync
Errors if the stream does not emit any value within the specified duration.
The timeout operator monitors the time interval between emissions from the source stream.
If the source stream does not emit any value within the specified duration, the operator
emits a FluxionError::TimeoutError with “Timeout” context and terminates the stream.
- If the source emits a value, the timer is reset.
- If the source completes, the timeout operator completes.
- If the source errors, the error is passed through.
§Arguments
duration- The timeout duration
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.