impl<I, R> ExactSizeIterator for MapSpecialCase<I, R> where
I: ExactSizeIterator,
R: MapSpecialCaseFn<I::Item>,
{
}
/// An iterator adapter to apply a transformation within a nested `Result::Ok`. /// /// See [`.map_ok()`](crate::Itertools::map_ok) for more information. pubtype MapOk<I, F> = MapSpecialCase<I, MapSpecialCaseFnOk<F>>;
/// See [`MapOk`]. #[deprecated(note = "Use MapOk instead", since = "0.10.0")] pubtype MapResults<I, F> = MapOk<I, F>;
impl<F, T, U, E> MapSpecialCaseFn<Result<T, E>> for MapSpecialCaseFnOk<F> where
F: FnMut(T) -> U,
{ type Out = Result<U, E>; fn call(&mutself, t: Result<T, E>) -> Self::Out {
t.map(|v| self.0(v))
}
}
impl<F> std::fmt::Debug for MapSpecialCaseFnOk<F> {
debug_fmt_fields!(MapSpecialCaseFnOk,);
}
/// Create a new `MapOk` iterator. pubfn map_ok<I, F, T, U, E>(iter: I, f: F) -> MapOk<I, F> where
I: Iterator<Item = Result<T, E>>,
F: FnMut(T) -> U,
{
MapSpecialCase {
iter,
f: MapSpecialCaseFnOk(f),
}
}
/// An iterator adapter to apply `Into` conversion to each element. /// /// See [`.map_into()`](crate::Itertools::map_into) for more information. pubtype MapInto<I, R> = MapSpecialCase<I, MapSpecialCaseFnInto<R>>;
impl<T: Into<U>, U> MapSpecialCaseFn<T> for MapSpecialCaseFnInto<U> { type Out = U; fn call(&mutself, t: T) -> Self::Out {
t.into()
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.