nom breaking changes

cargo

109 curated breaking changes across major versions of nom. Use this as a migration checklist before bumping dependencies.

109
changes
Breaking changes by transition
  • 7.1.2 \u2192 8.0.0breaking

    `parse` combinator

  • 7.1.2 \u2192 8.0.0breaking

    `nom::bits::*` is no longer re-exported at the crate root. This export caused frequent confusion, since e.g. `nom::complete::tag` referred to `nom::bits::complete::tag` instead of the much more commonly used `nom::bytes::complete::tag`. To migrate, change any imports of `nom::{complete::*, streaming::*, bits, bytes}` to `nom::bits::[...]`.

  • 7.1.2 \u2192 8.0.0breaking

    `InputIter`, `InputTakeAtPosition`, `InputLength`, `InputTake` and `Slice` are now merged in the `Input` trait

  • 5.1.1 \u2192 6.0.0behavior

    the default error type is now a struct (`nom::error::Error`) instead of a tuple

  • 5.1.1 \u2192 6.0.0breaking

    there is now a more general `Parser` trait, so parsers can be something else than a function. This trait also comes with combinator methods like `map`, `flat_map`, `or`. Since it is implemented on `Fn*` traits, it should not affect existing code too much

  • 5.1.1 \u2192 6.0.0breaking

    the `FromExternalError` allows wrapping the error returned by the function in the `map_res` combinator

  • 5.1.1 \u2192 6.0.0breaking

    `separated_list` is now `separated_list0`

  • 5.1.1 \u2192 6.0.0breaking

    the minimal Rust version is now 1.44 (1.37 if building without the `alloc` or `std` features)

  • 5.1.1 \u2192 6.0.0breaking

    the `context` combinator is not linked to `ParseError` anymore, instead it come with its own `ContextError` trait

  • 5.1.1 \u2192 6.0.0breaking

    combinators that returned a `impl Fn` now return a `impl FnMut` to allow parser closures that capture some mutable value from the context

  • 5.1.1 \u2192 6.0.0breaking

    `separated_list` now allows empty elements

  • 5.1.1 \u2192 6.0.0breaking

    streaming parsers return the number of additional bytes they need, not the total. This was supposed to be the case everywhere, but some parsers were forgotten

  • 5.1.1 \u2192 6.0.0breaking

    `Needed::Size` now contains a `NonZeroUsize`, so we can reduce the structure's size by 8 bytes. When upgrading, `Needed::Size(number)` can be replaced with `Needed::new(number)`

  • 5.1.1 \u2192 6.0.0removed

    removed the deprecated `methods` module

  • 5.1.1 \u2192 6.0.0removed

    removed the `regexp_macros` cargo feature

  • 5.1.1 \u2192 6.0.0removed

    removed the deprecated `whitespace` module

  • 5.1.1 \u2192 6.0.0renamed

    renamed the `dbg!` macro to avoid conflicts with `std::dbg!`

  • 3.2.1 \u2192 4.0.0api

    the arguments from `error_position` and other such macros were swapped to be more consistent with the rest of nom

  • 3.2.1 \u2192 4.0.0breaking

    `many0` and other related parsers will now return `Incomplete` if the reach the end of input without an error of the child parser. They will also return `Incomplete` on an empty input

  • 3.2.1 \u2192 4.0.0breaking

    the `IResult` type now becomes a `Result` from the standard library

  • 3.2.1 \u2192 4.0.0breaking

    `Incomplete` now returns the additional data size needed, not the total data size needed

  • 3.2.1 \u2192 4.0.0breaking

    verbose-errors is now a superset of basic errors

  • 3.2.1 \u2192 4.0.0breaking

    all the errors now include the related input slice

  • 3.2.1 \u2192 4.0.0breaking

    automatic error conversion: to fix error type inference issues, a custom error type must now implement `std::convert::From<u32>`

  • 3.2.1 \u2192 4.0.0breaking

    the `not!` combinator returns unit `()`

  • 3.2.1 \u2192 4.0.0breaking

    FindToken's calling convention was swapped

  • 3.2.1 \u2192 4.0.0breaking

    the `take_*` combinators are now more coherent and stricter, see commit 484f6724ea3ccb for more information

  • 3.2.1 \u2192 4.0.0breaking

    the `sep!` combinator for whitespace only consumes whitespace in the prefix, while the `ws!` combinator takes care of consuming the remaining whitespace

  • 2.2.1 \u2192 3.0.0breaking

    `InputIter` does not require `AsChar` on its `Item` type anymore

  • 2.2.1 \u2192 3.0.0breaking

    `escaped`, `separated_list` and `separated_nonempty_list` can now return `Incomplete` when necessary

  • 2.2.1 \u2192 3.0.0breaking

    in `verbose-errors` mode, the error list is now stored in a `Vec` instead of a box based linked list

  • 2.2.1 \u2192 3.0.0removed

    the `core` feature that was putting nom in `no_std` mode has been removed. There is now a `std` feature, activated by default. If it is not activated, nom is in `no_std`

  • 2.2.1 \u2192 3.0.0removed

    `chain!` has finally been removed

  • 2.0 \u2192 2.0.1breaking

    @jtdowney for noticing that `tag_no_case!` was not working at all for byte slices

  • 2.0 \u2192 2.0.1breaking

    @nickbabcock for catching and fixing the `add_error!` mixup

  • 2.0 \u2192 2.0.1breaking

    @lucab for documentation fixes

  • 2.0 \u2192 2.0.1breaking

    the `not!` combinator now accepts functions

  • 2.0 \u2192 2.0.1breaking

    `tag_no_case!` is now working as accepted (before, it accepted everything)

  • 2.0 \u2192 2.0.1renamed

    `add_error!` has been renamed to `add_return_error!`

  • 1.2.4 \u2192 2.0behavior

    @keeperofdakeys for fixing eol behaviour, writing documentation and adding `named_attr!`

  • 1.2.4 \u2192 2.0behavior

    `tag_no_case!` provides case independent comparison. It works nicely, without any allocation, for ASCII strings, but for UTF-8 strings, it defaults to an unsatisfying (and incorrect) comparison by lowercasing both strings

  • 1.2.4 \u2192 2.0behavior

    the "simple" error management system does not accumulates errors when backtracking. This is a big perf gain, and is activated by default in nom 2.0

  • 1.2.4 \u2192 2.0breaking

    @keruspe for documentation and example fixes, for the `IResult => Result` conversion work, making `AsChar`'s method more consistent, and adding `many_till!`

  • 1.2.4 \u2192 2.0breaking

    @lu-zero for license help

  • 1.2.4 \u2192 2.0breaking

    @adamgreig for type inference fixes

  • 1.2.4 \u2192 2.0breaking

    @jdeeny for implementing `Offset` on `&str`

  • 1.2.4 \u2192 2.0breaking

    @vickenty for documentation fixes and his refactoring of `length_value!` and `length_bytes!`

  • 1.2.4 \u2192 2.0breaking

    @overdrivenpotato for refactoring some combinators

  • 1.2.4 \u2192 2.0breaking

    @taralx for documentation fixes

  • 1.2.4 \u2192 2.0breaking

    @jturner314 for writing documentation

  • 1.2.4 \u2192 2.0breaking

    @bozaro for fixing compilation errors

  • 1.2.4 \u2192 2.0breaking

    @uniphil for adding a `crates.io` badge

  • 1.2.4 \u2192 2.0breaking

    @badboy for documentation fixes

  • 1.2.4 \u2192 2.0breaking

    @jugglerchris for fixing `take_s!`

  • 1.2.4 \u2192 2.0breaking

    @AndyShiue for implementing `Error` and `Display` on `ErrorKind` and detecting incorrect UTF-8 string indexing

  • 1.2.4 \u2192 2.0breaking

    nom can now work on any type that implement the traits defined in `src/traits.rs`: `InputLength`, `InputIter`, `InputTake`, `Compare`, `FindToken`, `FindSubstring`, `Slice`

  • 1.2.4 \u2192 2.0breaking

    the documentation from Github's wiki has been moved to the `doc/` directory. They are markdown files that you can build with [cargo-external-doc](https://crates.io/crates/cargo-external-doc)

  • 1.2.4 \u2192 2.0breaking

    whitespace separated format support: with the `ws!` combinator, you can automatically introduce whitespace parsers between all parsers and combinators

  • 1.2.4 \u2192 2.0breaking

    the `permutation!` combinator applies its child parsers in any order, as long as they all succeed once, and return a tuple of the results

  • 1.2.4 \u2192 2.0breaking

    you can now transform an `IResult` in a `std::result::Result`

  • 1.2.4 \u2192 2.0breaking

    `length_data!` parses a length, and returns a subslice of that length

  • 1.2.4 \u2192 2.0breaking

    `named_attr!` creates functions like `named!` but can add attributes like documentation

  • 1.2.4 \u2192 2.0deprecated

    `do_parse!` is a simpler alternative to `chain!`, which is now deprecated

  • 1.0.1 \u2192 1.1.0api

    `value!` is a combinator that always returns the same value. If a child parser is passed as second argument, that value is returned when the child parser succeeds

  • 1.0.1 \u2192 1.1.0breaking

    @meh for fixing `Option` and `Vec` imports

  • 1.0.1 \u2192 1.1.0breaking

    @hoodie for a documentation fix

  • 1.0.1 \u2192 1.1.0breaking

    @joelself for some documentation fixes

  • 1.0.1 \u2192 1.1.0breaking

    @vberger for his traits magic making nom functions more generic

  • 1.0.1 \u2192 1.1.0breaking

    string related parsers: `tag_s!`, `take_s!`, `is_a_s!`, `is_not_s!`, `take_while_s!`, `take_while1_s!`, `take_till_s!`

  • 1.0.1 \u2192 1.1.0breaking

    `tag!` will now compare even on partial input. If it expects "abcd" but receives "ef", it will now return an `Error` instead of `Incomplete`

  • 1.0.1 \u2192 1.1.0breaking

    `many0!` and others will preallocate a larger vector to avoid some copies and reallocations

  • 1.0.1 \u2192 1.1.0breaking

    `take_while!`, `take_while1!`, `take_while_s!`, `take_while1_s!` wilreturn an error on empty input

  • 1.0.1 \u2192 1.1.0breaking

    if the child parser of `many0!` or `many1!` returns `Incomplete`, it will return `Incomplete` too, possibly updating the needed size

  • 1.0.1 \u2192 1.1.0breaking

    `Option,` `Some`, `None` and `Vec` are now used with full path imports

  • 1.0.1 \u2192 1.1.0breaking

    `alpha`, `digit`, `alphanumeric`, `space` and `multispace` now accept as input a `&[u8]` or a `&str`. Additionally, they return an error if they receive an empty input

  • 1.0.1 \u2192 1.1.0breaking

    @Binero for pushing the work on `&str` parsing

  • 0.5.0 \u2192 1.0.0breaking

    `IResult` does not require a lifetime tag anymore, yay!

  • 0.5.0 \u2192 1.0.0breaking

    Producers and consumers have been replaced. The new implementation uses less memory and integrates more with parsers

  • 0.5.0 \u2192 1.0.0breaking

    `nom::ErrorCode` is now `nom::ErrorKind`

  • 0.5.0 \u2192 1.0.0breaking

    `IResult::Error` can now use custom error types, and is generic over the input type

  • 0.5.0 \u2192 1.0.0breaking

    `chain!` will count how much data is consumed and use that number to calculate how much data is needed if a parser returned `Incomplete`

  • 0.5.0 \u2192 1.0.0breaking

    `alt!` returns `Incomplete` if a child parser returned `Incomplete`, instead of skipping to the next parser

  • 0.5.0 \u2192 1.0.0renamed

    `filter!` has been renamed to `take_while!`

  • 0.3.11 \u2192 0.4.0api

    `count_fixed!` must take an explicit type as argument to generate the fixed-size array

  • 0.3.11 \u2192 0.4.0behavior

    optional parsing behaviour in `chain!`

  • 0.3.11 \u2192 0.4.0breaking

    @meh for fixes on `chain!` and for the `rest` parser

  • 0.3.11 \u2192 0.4.0breaking

    @daboross for refactoring `many0!` and `many1!`

  • 0.3.11 \u2192 0.4.0breaking

    @aleksander for the `switch!` combinator idea

  • 0.3.11 \u2192 0.4.0breaking

    @TechnoMancer for his help with bit level parsing

  • 0.3.11 \u2192 0.4.0breaking

    @sxeraverx for pointing out a bug in `is_a!`

  • 0.3.11 \u2192 0.4.0breaking

    @frewsxcv for documentation fixes

  • 0.3.11 \u2192 0.4.0breaking

    performance improvement for `filter!`

  • 0.3.11 \u2192 0.4.0breaking

    @ngrewe for his work on producers and consumers

  • 0.3.11 \u2192 0.4.0breaking

    `count!` can take 0 elements

  • 0.3.11 \u2192 0.4.0breaking

    `is_a!` and `is_not!` can now consume the whole input

  • 0.3.11 \u2192 0.4.0breaking

    it is now possible to seek to the end of a `MemProducer`

  • 0.3.11 \u2192 0.4.0breaking

    `opt!` returns `Done(input, None)` if `the child parser returned `Incomplete`

  • 0.3.11 \u2192 0.4.0breaking

    `rest` will return the remaining input

  • 0.3.11 \u2192 0.4.0breaking

    consumers can now seek to and from the end of input

  • 0.3.11 \u2192 0.4.0breaking

    `switch!` applies a first parser then matches on its result to choose the next parser

  • 0.3.11 \u2192 0.4.0breaking

    bit-level parsers

  • 0.3.11 \u2192 0.4.0breaking

    character-level parsers

  • 0.3.11 \u2192 0.4.0breaking

    regular expression parsers

  • 0.3.11 \u2192 0.4.0breaking

    implementation of `take_till!`, `take_while!` and `take_while1!`

  • 0.3.11 \u2192 0.4.0breaking

    `alt!` can return `Incomplete`

  • 0.3.11 \u2192 0.4.0breaking

    the error analysis functions will now take references to functions instead of moving them

  • 0.3.11 \u2192 0.4.0breaking

    performance improvements on producers

  • 0.1.6 \u2192 0.2.0breaking

    the `fold0!` and `fold1!` macros were too complex and awkward to use, the `many*` combinators will be useful for most uses for now

  • 0.1.6 \u2192 0.2.0removed

    the `o!` macro does less than `chain!`, so it has been removed

API access

Get this data programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/breaking/cargo/nom
nom breaking changes — Cargo migration guide | DepScope