[][src]Function nom::combinator::into

pub fn into<I, O1, O2, E, F>(parser: F) -> impl FnMut(I) -> IResult<I, O2, E> where
    O1: Into<O2>,
    E: ParseError<I>,
    F: Fn(I) -> IResult<I, O1, E>, 

automatically converts the child parser's output to another type

use nom::combinator::into;
use nom::character::complete::alpha1;

let mut parser = into(alpha1);

// the parser converts the &str output of the child parser into a Vec<u8>
let bytes: IResult<&str, Vec<u8>> = parser("abcd");
assert_eq!(bytes, Ok(("", vec![97, 98, 99, 100])));