Crate intersection
source ·Expand description
A crate to find the intersection between a collection of sets. Convenient when your collection of sets consists of more than 2 sets.
There are two options:
- With
HashSet
, usehash_set::intersection
. - With
BTreeSet
, usebtree_set::intersection
.
Why use this over HashSet::intersection
or BTreeSet::intersection
?
The standard library intersection methods require a bit of ceremony when you want to intersect 3
or more sets with each other. These intersection(other: &Set)
methods produce a lazy iterator,
which you then have to wrap into a HashSet::from_iter
again. An alternative way is to use
the BitAnd
implementation of either set. In both cases it requires a bit of boilerplate
which this library does for you =).