Macro bitvec::bitvec[][src]

macro_rules! bitvec {
    ( $end:ident , $prim:ty ; $( $elt:expr ),* ) => { ... };
    ( $end:ident , $prim:ty ; $( $elt:expr , )* ) => { ... };
    ( $end:ident ; $( $elt:expr ),* ) => { ... };
    ( $end:ident ; $( $elt:expr , )* ) => { ... };
    ( $( $elt:expr ),* ) => { ... };
    ( $( $elt:expr , )* ) => { ... };
    ( $end:ident , $prim:ty ; $elt:expr ; $rep:expr ) => { ... };
    ( $end:ident ; $elt:expr ; $rep:expr ) => { ... };
    ( $elt:expr ; $rep:expr ) => { ... };
}

Construct a BitVec out of a literal array in source code, analagous to vec!.

bitvec! can be invoked in a number of ways. It takes the name of an Endian implementation, the name of a Bits-implementing primitive, and zero or more primitives (integer, floating-point, or bool) which are used to build the bits. Each primitive literal corresponds to one bit, and is considered to represent 1 if any bit in the representation is set.

bitvec! can be invoked with no specifiers, and Endian specifier, or an Endian and a Bits specifier. It cannot be invoked with a Bits specifier but no Endian specifier, due to overlap in how those tokens are matched by the macro system.

Like vec!, bitvec! supports bit lists [0, 1, ...] and repetition markers [1; n].

All Syntaxes

bitvec![BigEndian, u8; 0, 1];
bitvec![LittleEndian, u8; 0, 1,];
bitvec![BigEndian; 0, 1];
bitvec![LittleEndian; 0, 1,];
bitvec![0, 1];
bitvec![0, 1,];
bitvec![BigEndian, u8; 1; 5];
bitvec![LittleEndian; 0; 5];
bitvec![1; 5];