Function nom8::combinator::recognize
source · pub fn recognize<I, O, E: ParseError<I>, F>(
parser: F
) -> impl FnMut(I) -> IResult<I, <I as IntoOutput>::Output, E>where
I: Clone + Offset + Slice<RangeTo<usize>> + IntoOutput,
F: Parser<I, O, E>,
👎Deprecated since 8.0.0: Replaced with `Parser::recognize
Expand description
If the child parser was successful, return the consumed input as produced value.
WARNING: Deprecated, replaced with Parser::recognize
use nom8::combinator::recognize;
use nom8::character::{alpha1};
use nom8::sequence::separated_pair;
let mut parser = recognize(separated_pair(alpha1, ',', alpha1));
assert_eq!(parser("abcd,efgh"), Ok(("", "abcd,efgh")));
assert_eq!(parser("abcd;"),Err(Err::Error((";", ErrorKind::OneOf))));