Trait FusedStream

Source
pub trait FusedStream: Stream { }
Available on unstable only.
Expand description

A stream that always continues to yield None when exhausted.

Calling next on a fused stream that has returned None once is guaranteed to return None again. This trait should be implemented by all streams that behave this way because it allows optimizing Stream::fuse.

Note: In general, you should not use FusedStream in generic bounds if you need a fused stream. Instead, you should just call Stream::fuse on the stream. If the stream is already fused, the additional Fuse wrapper will be a no-op with no performance penalty.

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.

Implementations on Foreign Types§

Source§

impl<S: FusedStream + ?Sized + Unpin> FusedStream for &mut S

Implementors§