[][src]Macro nom::length_bytes

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

length_bytes!(&[T] -> IResult<&[T], nb>) => &[T] -> IResult<&[T], &[T]> Gets a number from the first parser, then extracts that many bytes from the remaining stream

Example

 named!(with_length, length_bytes!( be_u8 ));
 let r = with_length(&b"\x05abcdefgh"[..]);
 assert_eq!(r, Ok((&b"fgh"[..], &b"abcde"[..])));