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