Macro bv::bit_vec[][src]

macro_rules! bit_vec {
    ( $e:expr ; $n:expr ) => { ... };
    ( $( $e:expr ),* ) => { ... };
    ( $( $e:expr, )* ) => { ... };
}
Expand description

Like vec! but for BitVec.

The bit_vec! macro creates a BitVec literal. It takes two forms:

  • A single bool, followed by a semicolon and number of times to repeat. This is equivalent to a call to BitVec::new_fill.

  • A sequence of comma-separated bools; this creates a BitVec and pushes each bool in turn.

Examples

use bv::*;

fn main() {
    let mut bv1: BitVec = bit_vec![ true; 3 ];
    let     bv2: BitVec = bit_vec![ true, false, true ];

    assert_ne!(bv1, bv2);
    bv1.set_bit(1, false);
    assert_eq!(bv1, bv2);
}