Function gen_vec

Source
pub fn gen_vec(
    n: usize,
) -> impl DoubleEndedIterator<Item = Vec<bool>> + ExactSizeIterator + FusedIterator
Expand description

Returns an Iterator producing Vec<bool> for each possible combinations of n bools.

Note: If a Vec<bool> is not needed for each combination, then consider using gen_slice() or gen_vec_slice() instead.

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_vec(n).collect::<Vec<_>>();

assert_eq!(
    combinations,
    [
        vec![false, false],
        vec![true, false],
        vec![false, true],
        vec![true, true],
    ]
);