Trait lending_stream::LendingStream

source ·
pub trait LendingStream {
    type Item<'a>
       where Self: 'a;

    // Required method
    fn poll_next(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Option<Self::Item<'_>>>;

    // Provided methods
    fn size_hint(&self) -> (usize, Option<usize>) { ... }
    fn next(&mut self) -> Next<'_, Self> 
       where Self: Unpin { ... }
}
Expand description

An interface for dealing with iterators which borrow from Self

Required Associated Types§

source

type Item<'a> where Self: 'a

The type of the elements being iterated over.

Required Methods§

source

fn poll_next(&mut 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 async iterator is exhausted.

Provided Methods§

source

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the Stream.

source

fn next(&mut self) -> Next<'_, Self>
where Self: Unpin,

Retrieves the next item in the stream.

Returns None when iteration is finished. Stream implementations may choose to or not to resume iteration after that.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I: Stream + Unpin> LendingStream for Lend<I>

§

type Item<'a> = (&'a I, <I as Stream>::Item) where Self: 'a

source§

impl<I: Stream + Unpin> LendingStream for LendMut<I>

§

type Item<'a> = (&'a mut I, <I as Stream>::Item) where Self: 'a