Struct futures::stream::Peekable [] [src]

#[must_use = "streams do nothing unless polled"]
pub struct Peekable<S> where
    S: Stream
{ /* fields omitted */ }

A Stream that implements a peek method.

The peek method can be used to retrieve a reference to the next Stream::Item if available. A subsequent call to poll will return the owned item.


impl<S> Peekable<S> where
    S: Stream


Peek retrieves a reference to the next item in the stream.

This method polls the underlying stream and return either a reference to the next item if the stream is ready or passes through any errors.

Trait Implementations

impl<S> Sink for Peekable<S> where
    S: Sink + Stream

The type of value that the sink accepts.

The type of value produced by the sink when an error occurs.


Attempts to prepare the Sink to receive a value. Read more


Begin the process of sending a value to the sink. Each call to this function must be proceeded by a successful call to poll_ready which returned Ok(Async::Ready(())). Read more


Flush any remaining output from this sink. Read more


Flush any remaining output and close this sink, if necessary. Read more

impl<S> Debug for Peekable<S> where
    S: Debug + Stream,
    <S as Stream>::Item: Debug


Formats the value using the given formatter. Read more

impl<S> Stream for Peekable<S> where
    S: Stream

Values yielded by the stream.

Errors yielded by the stream.


Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more

Auto Trait Implementations

impl<S> Send for Peekable<S> where
    S: Send,
    <S as Stream>::Item: Send

impl<S> Sync for Peekable<S> where
    S: Sync,
    <S as Stream>::Item: Sync