Function malachite_base::options::exhaustive::exhaustive_somes
source · [−]pub const fn exhaustive_somes<I: Iterator>(xs: I) -> ExhaustiveSomes<I>ⓘNotable traits for ExhaustiveSomes<I>impl<I: Iterator> Iterator for ExhaustiveSomes<I> type Item = Option<I::Item>;
Expand description
Generates all Option
s except None
, with values from a given iterator.
The elements of the given iterator are wrapped in Some
and generated in the original order.
The output length is xs.count()
.
Examples
extern crate itertools;
use itertools::Itertools;
use malachite_base::options::exhaustive::exhaustive_somes;
assert_eq!(
exhaustive_somes([1, 2, 3].iter().cloned()).collect_vec(),
&[Some(1), Some(2), Some(3)]
);