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<O>(
self,
map: fn(Self::Item, &Self::Context) -> O,
) -> MapCtx<Self, O> ⓘ
where Self: Sized { ... }
fn filter_with_context(
self,
filter: fn(&Self::Item, &Self::Context) -> bool,
) -> FilterCtx<Self> ⓘ
where Self: Sized { ... }
fn filter_map_with_context<O>(
self,
filter: fn(Self::Item, &Self::Context) -> Option<O>,
) -> FilterMapCtx<Self, O> ⓘ
where Self: Sized { ... }
}
Expand description
Iterator carrying a context.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn context_map<F, O>(self, map: F) -> CtxMap<Self, F> ⓘ
fn context_map<F, O>(self, map: F) -> CtxMap<Self, F> ⓘ
Get the context.
Sourcefn map_with_context<O>(
self,
map: fn(Self::Item, &Self::Context) -> O,
) -> MapCtx<Self, O> ⓘwhere
Self: Sized,
fn map_with_context<O>(
self,
map: fn(Self::Item, &Self::Context) -> O,
) -> MapCtx<Self, O> ⓘwhere
Self: Sized,
Apply a map to each element in the iterator.
Sourcefn filter_with_context(
self,
filter: fn(&Self::Item, &Self::Context) -> bool,
) -> FilterCtx<Self> ⓘwhere
Self: Sized,
fn filter_with_context(
self,
filter: fn(&Self::Item, &Self::Context) -> bool,
) -> FilterCtx<Self> ⓘwhere
Self: Sized,
Apply a filter over the elements of the iterator
Sourcefn filter_map_with_context<O>(
self,
filter: fn(Self::Item, &Self::Context) -> Option<O>,
) -> FilterMapCtx<Self, O> ⓘwhere
Self: Sized,
fn filter_map_with_context<O>(
self,
filter: fn(Self::Item, &Self::Context) -> Option<O>,
) -> FilterMapCtx<Self, O> ⓘwhere
Self: Sized,
Apply a filter over the elements of the iterator