Function chomp::combinators::matched_by [] [src]

pub fn matched_by<I: Input, T, E, F>(
    i: I,
    f: F
) -> ParseResult<I, (I::Buffer, T), E> where
    F: FnOnce(I) -> ParseResult<I, T, E>, 

Returns the result of the given parser as well as the slice which matched it.

use chomp::prelude::{parse_only, matched_by};
use chomp::ascii::decimal;

assert_eq!(parse_only(|i| matched_by(i, decimal), b"123"), Ok((&b"123"[..], 123u32)));