subsets
Every subset of items (the power set), including the empty one and items itself.
Subsets are ordered by the bit pattern that selects them (bit i set means items[i] is
in), so the empty subset comes first and items itself last, and the elements of each
subset keep their original order. The number of subsets doubles with every item, so more than
MAX_SUBSET_ITEMS items are refused.
Import
Section titled “Import”Cargo feature set (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
items | &[T] | The elements to choose from. |
Returns
Section titled “Returns”Option<Vec<Vec<T>>> — The 2^n subsets, or None when items has more than MAX_SUBSET_ITEMS elements.
