Macro nom::take_while_m_n
[−]
[src]
macro_rules! take_while_m_n { ($input:expr, $m:expr, $n:expr, $submac:ident!( $($args:tt)* )) => { ... }; ($input:expr, $m:expr, $n: expr, $f:expr) => { ... }; }
take_while_m_n!(m: usize, n: usize, T -> bool) => &[T] -> IResult<&[T], &[T]>
returns a list of bytes or characters for which the provided function returns true.
the returned list's size will be at least m, and at most n
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"[..])));