Struct futures::stream::Peekable [−][src]
#[must_use = "streams do nothing unless polled"]pub struct Peekable<St> where
St: 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.
Methods
impl<St> Peekable<St> where
St: Stream,
[src]
impl<St> Peekable<St> where
St: Stream,
pub fn peek(
self: &'a mut PinMut<Peekable<St>>,
cx: &mut Context
) -> Poll<Option<&'a <St as Stream>::Item>>
[src]
pub fn peek(
self: &'a mut PinMut<Peekable<St>>,
cx: &mut Context
) -> Poll<Option<&'a <St as Stream>::Item>>
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<St> Unpin for Peekable<St> where
St: Unpin + Stream,
[src]
impl<St> Unpin for Peekable<St> where
St: Unpin + Stream,
impl<St> Debug for Peekable<St> where
St: Debug + Stream,
<St as Stream>::Item: Debug,
[src]
impl<St> Debug for Peekable<St> where
St: Debug + Stream,
<St as Stream>::Item: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<S> Stream for Peekable<S> where
S: Stream,
[src]
impl<S> Stream for Peekable<S> where
S: Stream,
type Item = <S as Stream>::Item
Values yielded by the stream.
fn poll_next(
self: PinMut<Peekable<S>>,
cx: &mut Context
) -> Poll<Option<<Peekable<S> as Stream>::Item>>
[src]
fn poll_next(
self: PinMut<Peekable<S>>,
cx: &mut Context
) -> Poll<Option<<Peekable<S> as Stream>::Item>>
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