/// An iterator to iterate through the powerset of the elements from an iterator. /// /// See [`.powerset()`](crate::Itertools::powerset) for more /// information. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pubstruct Powerset<I: Iterator> {
combs: Combinations<I>, // Iterator `position` (equal to count of yielded elements).
pos: usize,
}
impl<I> Clone for Powerset<I> where I: Clone + Iterator,
I::Item: Clone,
{
clone_fields!(combs, pos);
}
impl<I> fmt::Debug for Powerset<I> where I: Iterator + fmt::Debug,
I::Item: fmt::Debug,
{
debug_fmt_fields!(Powerset, combs, pos);
}
/// Create a new `Powerset` from a clonable iterator. pubfn powerset<I>(src: I) -> Powerset<I> where I: Iterator,
I::Item: Clone,
{
Powerset {
combs: combinations(src, 0),
pos: 0,
}
}
impl<I> Iterator for Powerset<I> where
I: Iterator,
I::Item: Clone,
{ type Item = Vec<I::Item>;
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.