set
Helpers for HashSet that the standard library does not provide.
The standard library already has the pairwise operations (union, intersection, difference, …);
these cover what it lacks: combining any number of sets, toggling a member, a stable order, a
similarity score and the power set. Inputs are borrowed and results are new values.
Install
Section titled “Install”Cargo feature set (enabled by default). To compile only this module:
or in Cargo.toml:
Import path: helpers4::set.
| Item | What it does |
|---|---|
intersection_all | The elements that appear in every set of sets. |
jaccard | The Jaccard similarity of two sets: the size of their intersection over the size of their union. |
MAX_SUBSET_ITEMS | The most items subsets accepts: 2^16 = 65 536 subsets. |
subsets | Every subset of items (the power set), including the empty one and items itself. |
to_sorted_vec | The elements of set as a sorted Vec. |
toggle | Removes item from set if it is there, inserts it otherwise. |
union_all | The union of every set in sets. |
