LendingIterator

Trait LendingIterator 

Source
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) -> usize
where Self: Sized,

Source

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

Source

fn by_ref(&mut self) -> &mut Self
where 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) -> B
where Self: Sized, F: FnMut(B, Self::Item<'_>) -> B,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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

Available on crate feature std only.
Source§

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

Source§

impl<T> LendingIterator for T
where T: Iterator,

Source§

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