Module peekable_stream

Source
Expand description

Provides utilities for peeking at items in futures::Stream.

§Stability of peeked values

Implementors of this trait guarantee that a peeked Poll::Ready result is required to remain at the head of the stream until futures::Stream::poll_next or another method requiring a &mut reference (and documented to potentially change the head of the stream) is called. e.g. a caller holding a Pin<&mut Self> that observes a Ready value via PeekableStream::poll_peek is guaranteed to observe that same value again on a subsequent call to PeekableStream::poll_peek, futures::Stream::poll_next, etc.

This property must not be relied up on to prove soundness, but can be relied upon to prove correctness.

Traits§

PeekableStream
A stream that provides the ability to peek at the next available item.
UnobtrusivePeekableStream
A stream that supports peeking without perturbing any registered waker.