Skip to main content

poll_head

Function poll_head 

Source
fn poll_head<'p, S, T>(
    stream: Pin<&mut S>,
    peeked: &'p mut Option<T>,
    cx: &mut Context<'_>,
) -> Poll<Option<&'p T>>
where S: Stream<Item = T>,
Expand description

Lazily fill the cached head of stream into peeked and return a borrow.

On entry, Some(v) in peeked is a previously-buffered head that has not yet been consumed; None means the head must be pulled from the stream. Returns Ready(Some(&v)) when a head is available, Ready(None) once stream is exhausted, or Pending when waiting on the stream.