Macro bv::bit_vec [−][src]
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 toBitVec::new_fill
. -
A sequence of comma-separated
bool
s; this creates aBitVec
and pushes eachbool
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); }