Macro nom::flat_map [−][src]
flat_map!(R -> IResult<R,S>, S -> IResult<S,T>) => R -> IResult<R, T>
combines a parser R -> IResult<R,S> and a parser S -> IResult<S,T> to return another parser R -> IResult<R,T>
use nom::number::complete::recognize_float; named!(parser<&str, f64>, flat_map!(recognize_float, parse_to!(f64))); assert_eq!(parser("123.45;"), Ok((";", 123.45))); assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Char))));