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§
Sourcetype Item<'a>
where
Self: 'a
type Item<'a> where Self: 'a
Read Iterator::Item
.
Required Methods§
Sourcefn lend_next(&mut self) -> Option<Self::Item<'_>>
fn lend_next(&mut self) -> Option<Self::Item<'_>>
Read Iterator::next
.
Provided Methods§
Sourcefn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
Read Iterator::count
.
Sourcefn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read Iterator::by_ref
.
Sourcefn lend_try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>
fn lend_try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>
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.