Macro nom::bytes [−][src]
Counterpart to bits, bytes! transforms its bit stream input into a byte slice for the underlying parser, allowing byte-slice parsers to work on bit streams.
Signature:
bytes!( parser ) => ( (&[u8], usize), &[u8] -> IResult<&[u8], T> ) -> IResult<(&[u8], usize), T>
,
A partial byte remaining in the input will be ignored and the given parser will start parsing at the next full byte.
named!( parse<(u8, u8, &[u8])>, bits!( tuple!( take_bits!(4u8), take_bits!(8u8), bytes!(rest::<_, (_, ErrorKind)>) ))); let input = &[0xde, 0xad, 0xbe, 0xaf]; assert_eq!(parse( input ), Ok(( &[][..], (0xd, 0xea, &[0xbe, 0xaf][..]) )));