Function chomp::combinators::skip_many
[−]
[src]
pub fn skip_many<'a, I, T, E, F>(i: Input<'a, I>, f: F) -> ParseResult<'a, I, (), E> where T: 'a, F: FnMut(Input<'a, I>) -> ParseResult<'a, I, T, E>
Runs the given parser until it fails, discarding matched input.
Incomplete state will be propagated.
This is more efficient compared to using many
and then just discarding the result as
many
allocates a separate data structure to contain the data before proceeding.
use chomp::{parse_only, skip_many, token}; let r = parse_only(|i| skip_many(i, |i| token(i, b'a')).then(|i| token(i, b'b')), b"aaaabc"); assert_eq!(r, Ok(b'b'));