chomp v0.3.1 Release Notes
Release Date: 2016-09-06 // over 8 years ago-
โ Added
- ๐
combinators::either
: Likeor
but allows different result types from the parsers.
๐ Changes
- Chomp is now licensed under both MIT and Apache-2.0 licenses.
๐ Bugfixes
- ๐ Feature
tendril
now compiles again.
- ๐
Previous changes from v0.3.0
-
โ Added
๐
prelude
module containing basic types, parsers and combinators.๐ฆ This is supposed to be the equivalent of Attoparsec's main package.
๐
run_parser
which executes a parser on any givenInput
type.buffer::InputBuf
which contains a slice and an incomplete flag, much as the oldInput
struct.Input<Token=T, Buffer=&[T]>
implementation for&[T]
whereT: Copy + PartialEq
.Input<Token=char, Buffer=&str>
implementation for&str
.types::Buffer
trait which is implemented for all buffers providing common logic to perform the
๐ final parsing on a buffer without knowing the exact buffer implementation.types::U8Input
trait alias forInput<Token=u8>
.primitives::Primitives
trait providing access to the primitive methods of theInput
trait.๐ This is used for building fundamental parsers/combinators.
๐
ParseResult::inspect
allowing code to observe the success value.types::numbering
module for creating position-awareInput
types.๐
parsers::skip_while
using an efficient way of skipping data if provided, otherwise falls back
on usingtake_while
and throws the result away.๐
chomp::Error
now includes a backtrace intest
anddebug
build profiles thanks to the
debugtrace crate. Backtraces can also be activated
permanently using thebacktrace
feature but this will incur the significant cost of allocating
๐ backtraces even in therelease
profile.๐ Feature
noop_error
provides a zero-sized error type for the cases when the expected token is
๐ unimportant. Provides a small performance boost.๐ Changes
Backwards-incompatible:
Input
is now a trait with associated typesToken
andBuffer
.๐ This removes all incomplete logic from the parsers themselves and moves it into the
InputBuf
๐ type. ThisInputBuf
is 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
Input
implementation.โฌ๏ธ To upgrade you replace the previous concrete
Input
type with a generic, use its associated
๐ type if required, and refer to theBuffer
associated 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 aprelude
module.Backwards-incompatible:
chomp::Error
is no longer an enum, this is to facillitate the
๐ support of backtraces while keeping code compatible between the different build profiles.๐ Use
chomp::Error::expected_token
to determine if a specific token was expected.๐ Feature
verbose_error
is now defaultโ Removed
Input::incomplete
Input::new
- ๐
ParseResult::expect
- ๐
ParseResult::unwrap_err
- ๐
ParseResult::unwrap
buffer::IntoStream
- ๐ฏ
primitives::InputClone
primitives::State
๐ Bugfixes
- ๐
combinators::bounded
now have a defined behavior when aRange<usize>
hasstart == end
: They will parse exactlystart
times. This also fixed a few overflows and unreachable code being reachable. - ๐
combinators::bounded::many_till
got fixed for an overflow happening when0: usize
was used to limit the number of iterations.