pub trait LendingIterator {
    type Item<'a>
       where Self: 'a;

    // Required method
    fn lend_next(&mut self) -> Option<Self::Item<'_>>;

    // Provided methods
    fn size_hint(&self) -> (usize, Option<usize>) { ... }
    fn count(self) -> usize
       where Self: Sized { ... }
    fn advance_by(&mut self, n: usize) -> Result<(), usize> { ... }
    fn by_ref(&mut self) -> &mut Self
       where Self: Sized { ... }
    fn lend_try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>
       where Self: Sized,
             F: FnMut(B, Self::Item<'_>) -> Result<B, E> { ... }
    fn lend_fold<B, F>(self, init: B, f: F) -> B
       where Self: Sized,
             F: FnMut(B, Self::Item<'_>) -> B { ... }
}
Expand description

Generalizes Iterator by allowing one to yield references.

Required Associated Types§

source

type Item<'a> where Self: 'a

Required Methods§

source

fn lend_next(&mut self) -> Option<Self::Item<'_>>

Provided Methods§

source

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

source

fn count(self) -> usizewhere Self: Sized,

source

fn advance_by(&mut self, n: usize) -> Result<(), usize>

source

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

source

fn lend_try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>where Self: Sized, F: FnMut(B, Self::Item<'_>) -> Result<B, E>,

source

fn lend_fold<B, F>(self, init: B, f: F) -> Bwhere Self: Sized, F: FnMut(B, Self::Item<'_>) -> B,

Implementors§

source§

impl<R> LendingIterator for EvalIter<R>where R: BufRead,

Available on crate feature std only.
§

type Item<'a> = Result<O<'a>, E> where Self: 'a

source§

impl<T> LendingIterator for Twhere T: Iterator,

§

type Item<'a> = <T as Iterator>::Item where Self: 'a