Trait mz_repr::row::iter::RowIterator
source · pub trait RowIterator: Debug {
// Required methods
fn next(&mut self) -> Option<&RowRef>;
fn peek(&mut self) -> Option<&RowRef>;
fn count(&self) -> usize;
// Provided method
fn map<T, F>(self, f: F) -> MappedRowIterator<Self, F> ⓘ
where Self: Sized,
F: FnMut(&RowRef) -> T { ... }
}
Expand description
An iterator that can borrow from self
and yield RowRef
s.
This trait is a “lending iterator” for Row
s, in other words, an iterator that borrows from
self (e.g. an underlying memory buffer) to return a RowRef
. The std::iter::Iterator
trait does not currently support this pattern because there is no way to name the lifetime of
the borrow on its associated Item
type. Generic Associated Types (GATs) would allow this but
so far no new trait has been introduced with this API.
There are a few open source crates that provide a trait:
Neither have an IntoLendingIterator
trait that is useful for our interface, nor do they work
well with trait objects.
Required Methods§
Provided Methods§
sourcefn map<T, F>(self, f: F) -> MappedRowIterator<Self, F> ⓘ
fn map<T, F>(self, f: F) -> MappedRowIterator<Self, F> ⓘ
Maps the returned RowRef
s from this RowIterator
.