[][src]Macro nom::take_while_s

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

: Please use take_while instead

take_while_s!(char -> bool) => &str -> IResult<&str, &str> returns the longest list of characters until the provided function fails.

The argument is either a function char -> bool or a macro returning a `bool

 fn alphabetic(chr: char) -> bool { (chr >= 0x41 as char && chr <= 0x5A as char) || (chr >= 0x61 as char && chr <= 0x7A as char) }
 named!( alpha<&str,&str>, take_while_s!( alphabetic ) );

 let r = alpha("abcd\nefgh");
 assert_eq!(r,Ok(("\nefgh", "abcd")));