[−][src]Macro nom::take_while
take_while!(T -> bool) => &[T] -> IResult<&[T], &[T]>
returns the longest list of bytes until the provided function fails.
The argument is either a function T -> bool
or a macro returning a bool
.
Example
named!( alpha, take_while!( is_alphanumeric ) ); let r = alpha(&b"abcd\nefgh"[..]); assert_eq!(r, Ok((&b"\nefgh"[..], &b"abcd"[..])));