[−][src]Macro nom::take_till1
take_till1!(T -> bool) => &[T] -> IResult<&[T], &[T]>
returns the longest non empty list of bytes until the provided function succeeds
The argument is either a function &[T] -> bool
or a macro returning a bool
.
Example
named!( till1_colon, take_till1!(|ch| ch == b':') ); let r = till1_colon(&b"abcd:efgh"[..]); assert_eq!(r, Ok((&b":efgh"[..], &b"abcd"[..]))); let r2 = till1_colon(&b":abcdefgh"[..]); // empty match is error assert_eq!(r2, Err(Err::Error(error_position!(&b":abcdefgh"[..], ErrorKind::TakeTill1))));