### 1 stable release

1.0.0 | Dec 3, 2022 |
---|

#**1624** in Data structures

**40** downloads per month

**MIT/Apache**

9KB

# intersection

## Table of contents

- ๐ Introduction
- ๐ Contributions & Feedback
- ๐งพ License

## Introduction

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

, use hash_set::intersection.`HashSet` - With

, use btree_set::intersection.`BTreeSet`

**Why use this over **

`or`

`HashSet`intersection`::`

`?`

`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

methods produce a lazy iterator,
which you then have to wrap into a `intersection``(`other`:` `&`Set`)`

again. An alternative way is to use
the `HashSet ::`from_iter

`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

Contributions, feedback or other correspondence are more than welcome! Feel free to send a message or create an issue ๐.

## License

Licensed under either of

- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

#### Contribution

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.