[][src]Macro nom::take_until_and_consume

macro_rules! take_until_and_consume {
    ($i:expr, $substr:expr) => { ... };
}

take_until_and_consume!(tag) => &[T] -> IResult<&[T], &[T]> generates a parser consuming bytes until the specified byte sequence is found, and consumes it

The parsed input and the tag are removed from the remainder. (As opposed to take_until! that does not remove the tag from the remainder.)

Example

 named!(x, take_until_and_consume!("foo"));
 let r = x(&b"abcd foo efgh"[..]);
 assert_eq!(r, Ok((&b" efgh"[..], &b"abcd "[..])));