nom::filter! [] [src]

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

filter!(&[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

 named!( alpha, filter!( is_alphanumeric ) );

 let r = alpha(&b"abcd\nefgh"[..]);
 assert_eq!(r, Done(&b"\nefgh"[..], &b"abcd"[..]));