Function chomp::combinators::matched_by
[−]
[src]
pub fn matched_by<'a, I, T, E, F>(i: Input<'a, I>, f: F) -> ParseResult<'a, I, (&'a [I], T), E> where T: 'a, F: FnOnce(Input<'a, I>) -> ParseResult<'a, I, T, E>
Returns the result of the given parser as well as the slice which matched it.
use chomp::{parse_only, matched_by}; use chomp::ascii::decimal; assert_eq!(parse_only(|i| matched_by(i, decimal), b"123"), Ok((&b"123"[..], 123u32)));