pub fn gen(
n: usize,
) -> impl DoubleEndedIterator<Item = Bools> + ExactSizeIterator + FusedIteratorExpand description
Returns an Iterator producing all possible combinations of n bools,
in the form of individual Bools iterators.
Alternatively, use gen_slice() or gen_vec_slice()
to receives &[bool] instead, where len() == n.
See also gen_const() for const generic variant.
See also implementation for more information
about the Iterator implementation.
§Panics
Panics if n is larger than the MAX number of supported variables.
However, you likely have other problems, if you encounter this.
See also count(n) and is_supported(n).
§Example
See crate root for more examples.
let n = 2;
let combinations = truth_values::gen(n)
.map(|mut bools| {
(bools.next().unwrap(), bools.next().unwrap())
})
.collect::<Vec<_>>();
assert_eq!(
combinations,
[
(false, false),
(true, false),
(false, true),
(true, true),
]
);