Crates.io | intersection |
lib.rs | intersection |
version | 1.0.0 |
source | src |
created_at | 2022-12-03 13:31:56.511024 |
updated_at | 2022-12-03 13:31:56.511024 |
description | Find the intersection over a collection of sets; when you need more than the intersection between two sets |
homepage | |
repository | |
max_upload_size | |
id | 729108 |
size | 25,332 |
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:
HashSet
, use hash_set::intersection.BTreeSet
, use btree_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 ๐. Under the hood, this library uses BitAnd
to produce an intersected
set of the given input sets.
Contributions, feedback or other correspondence are more than welcome! Feel free to send a message or create an issue ๐.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.