chomp v0.3.1 Release NotesRelease Date: 2016-09-06 // about 7 years ago
orbut allows different result types from the parsers.
- Chomp is now licensed under both MIT and Apache-2.0 licenses.
- 🔋 Feature
tendrilnow compiles again.
Previous changes from v0.3.0
preludemodule containing basic types, parsers and combinators.
📦 This is supposed to be the equivalent of Attoparsec's main package.
run_parserwhich executes a parser on any given
buffer::InputBufwhich contains a slice and an incomplete flag, much as the old
Input<Token=T, Buffer=&[T]>implementation for
T: Copy + PartialEq.
Input<Token=char, Buffer=&str>implementation for
types::Buffertrait which is implemented for all buffers providing common logic to perform the
📜 final parsing on a buffer without knowing the exact buffer implementation.
types::U8Inputtrait alias for
primitives::Primitivestrait providing access to the primitive methods of the
🏗 This is used for building fundamental parsers/combinators.
ParseResult::inspectallowing code to observe the success value.
types::numberingmodule for creating position-aware
parsers::skip_whileusing an efficient way of skipping data if provided, otherwise falls back
take_whileand throws the result away.
chomp::Errornow includes a backtrace in
debugbuild profiles thanks to the
debugtrace crate. Backtraces can also be activated
permanently using the
backtracefeature but this will incur the significant cost of allocating
🚀 backtraces even in the
noop_errorprovides a zero-sized error type for the cases when the expected token is
🐎 unimportant. Provides a small performance boost.
Inputis now a trait with associated types
🚚 This removes all incomplete logic from the parsers themselves and moves it into the
📜 type. This
InputBufis used if a partial buffer is in memory. It also allows the parsers to
operate directly on slices or use more effective means of storing buffers depending on the
⬆️ To upgrade you replace the previous concrete
Inputtype with a generic, use its associated
📜 type if required, and refer to the
Bufferassociated type to allow for zero-copy parsing::
-fn http_version(i: Input<u8>) -> U8Result<&[u8]>; +fn http_version<I: Input<Token=u8>>(i: I) -> SimpleResult<I, I::Buffer>;
The associated types can be restricted if requried:
fn request<I: U8Input>(i: I) -> SimpleResult<I, (Request<I::Buffer>, Vec<Header<I::Buffer>>)> where I::Buffer: ::std::ops::Deref<Target=[u8]>;
Backwards-incompatible: Moved types into a more logical module structure, prelude now
exists as a
chomp::Erroris no longer an enum, this is to facillitate the
👌 support of backtraces while keeping code compatible between the different build profiles.
chomp::Error::expected_tokento determine if a specific token was expected.
verbose_erroris now default
combinators::boundednow have a defined behavior when a
start == end: They will parse exactly
starttimes. This also fixed a few overflows and unreachable code being reachable.
combinators::bounded::many_tillgot fixed for an overflow happening when
0: usizewas used to limit the number of iterations.