Trait context_iterators::ContextIterator
source · pub trait ContextIterator: Iterator {
type Context;
// Required method
fn context(&self) -> &Self::Context;
// Provided methods
fn context_map<F, O>(self, map: F) -> CtxMap<Self, F> ⓘ
where Self: Sized,
F: Fn(&Self::Context) -> &O { ... }
fn map_with_context<F, O>(self, map: F) -> MapCtx<Self, F> ⓘ
where Self: Sized,
F: FnMut(Self::Item, &Self::Context) -> O { ... }
fn filter_with_context<F>(self, filter: F) -> FilterCtx<Self, F> ⓘ
where Self: Sized,
F: FnMut(&Self::Item, &Self::Context) -> bool { ... }
fn filter_map_with_context<F, O>(self, filter: F) -> FilterMapCtx<Self, F> ⓘ
where Self: Sized,
F: FnMut(Self::Item, &Self::Context) -> Option<O> { ... }
}
Expand description
Iterator carrying a context.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn context_map<F, O>(self, map: F) -> CtxMap<Self, F> ⓘwhere
Self: Sized,
F: Fn(&Self::Context) -> &O,
fn context_map<F, O>(self, map: F) -> CtxMap<Self, F> ⓘwhere Self: Sized, F: Fn(&Self::Context) -> &O,
Get the context.
sourcefn map_with_context<F, O>(self, map: F) -> MapCtx<Self, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Item, &Self::Context) -> O,
fn map_with_context<F, O>(self, map: F) -> MapCtx<Self, F> ⓘwhere Self: Sized, F: FnMut(Self::Item, &Self::Context) -> O,
Apply a map to each element in the iterator.
sourcefn filter_with_context<F>(self, filter: F) -> FilterCtx<Self, F> ⓘwhere
Self: Sized,
F: FnMut(&Self::Item, &Self::Context) -> bool,
fn filter_with_context<F>(self, filter: F) -> FilterCtx<Self, F> ⓘwhere Self: Sized, F: FnMut(&Self::Item, &Self::Context) -> bool,
Apply a filter over the elements of the iterator
sourcefn filter_map_with_context<F, O>(self, filter: F) -> FilterMapCtx<Self, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Item, &Self::Context) -> Option<O>,
fn filter_map_with_context<F, O>(self, filter: F) -> FilterMapCtx<Self, F> ⓘwhere Self: Sized, F: FnMut(Self::Item, &Self::Context) -> Option<O>,
Apply a filter over the elements of the iterator