nom::bits! [] [src]

macro_rules! bits {
    ($i:expr, $submac:ident!( $($args:tt)* )) => { ... };
    ($i:expr, $f:expr) => { ... };
}

bits!( parser ) => ( &[u8], (&[u8], usize) -> IResult<(&[u8], usize), T> ) -> IResult<&[u8], T> transforms its byte slice input in a bit stream for the underlying parsers

 named!( take_3_bits<u8>, bits!( take_bits!( u8, 3 ) ) );

 let input = vec![0b10101010, 0b11110000, 0b00110011];
 let sl    = &input[..];

 assert_eq!(take_3_bits( sl ), Done(&sl[1..], 5) );