m4rw3r/chomp

Parse utilities

m4rw3r opened this issue · 2 comments

Problem

Currently users have to either use the provided buffer::IntoStream trait or Input::new(&[I]). The first one might not be so useful, and the second one needs a replacement.

Proposed solution

fn parse_only<'i, I, T, E, D, P>(D, P) -> Result<T, ParseError<E>>
  where I: 'i,
            D: Into<&'i [I]>,
            I: 'i,
            T: 'i,
            E: 'i,
            P: FnOnce(Input<'i, I>) -> ParseResult<'i, I, T, E>;

Should work like Attoparsec's parseOnly.

Feature is finished, rewriting all the tests to use parse_only instead of Input::new and ParseResult::unwrap. See #10

Merged locally