Open
Description
This is a combinator I use all the time, might be useful to see something like it in this crate.
It drops a byte at a time until the given parser matches, then returns the result.
I don't do parsing in any really performance sensative contexts, this can probably be better implemented. This impl demonstrates the idea.
fn drop_until<'a, T>(
parser: fn(&'a str) -> IResult<&'a str, T>,
) -> impl FnMut(&'a str) -> IResult<&'a str, T> {
map(many_till(take(1u8), parser), |(_, matched)| matched)
}
Metadata
Metadata
Assignees
Labels
No labels