diff --git a/CHANGELOG.md b/CHANGELOG.md index 56709eae7..fc94c29d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,61 @@ ### Changed +## 7.1.2 - 2023-01-01 + +### Thanks + +- @joubs +- @Fyko +- @LoganDark +- @darnuria +- @jkugelman +- @barower +- @puzzlewolf +- @epage +- @cky +- @wolthom +- @w1ll-i-code + +### Changed + +- documentation fixes +- tests fixes +- limit the initial capacity of the result vector of `many_m_n` to 64kiB +- bits parser now accept `Parser` implementors instead of only functions + +### Added + +- implement `Tuple` parsing for the unit type as a special case +- implement `ErrorConvert` on the unit type to make it usable as error type for bits parsers +- bool parser for bits input + +## 7.1.1 - 2022-03-14 + +### Thanks + +- @ThomasdenH +- @@SphinxKnight +- @irevoire +- @doehyunbaek +- @pxeger +- @punkeel +- @max-sixty +- @Xiretza +- @5c077m4n +- @erihsu +- @TheNeikos +- @LoganDark +- @nickelc +- @chotchki +- @ctrlcctrlv + + +### Changed + +- documentation fixes +- more examples + ## 7.1.0 - 2021-11-04 ### Thanks @@ -1420,7 +1475,10 @@ Considering the number of changes since the last release, this version can conta ## Compare code -* [unreleased](https://github.com/Geal/nom/compare/7.0.0...HEAD) +* [unreleased](https://github.com/Geal/nom/compare/7.1.2...HEAD) +* [7.1.2](https://github.com/Geal/nom/compare/7.1.1...7.1.2) +* [7.1.1](https://github.com/Geal/nom/compare/7.1.0...7.1.1) +* [7.1.0](https://github.com/Geal/nom/compare/7.0.0...7.1.0) * [7.0.0](https://github.com/Geal/nom/compare/6.2.1...7.0.0) * [6.2.1](https://github.com/Geal/nom/compare/6.2.0...6.2.1) * [6.2.0](https://github.com/Geal/nom/compare/6.1.2...6.2.0) diff --git a/Cargo.toml b/Cargo.toml index d97e38e1b..c244efbfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nom" -version = "7.1.1" +version = "7.1.2" authors = [ "contact@geoffroycouprie.com" ] description = "A byte-oriented, zero-copy, parser combinators library" license = "MIT" diff --git a/src/bits/complete.rs b/src/bits/complete.rs index 2fd41e1ca..bf36dcc2a 100644 --- a/src/bits/complete.rs +++ b/src/bits/complete.rs @@ -121,8 +121,8 @@ where /// assert_eq!(parse(([0b10000000].as_ref(), 1)), Ok((([0b10000000].as_ref(), 2), false))); /// ``` pub fn bool>(input: (I, usize)) -> IResult<(I, usize), bool, E> - where - I: Slice> + InputIter + InputLength, +where + I: Slice> + InputIter + InputLength, { let (res, bit): (_, u32) = take(1usize)(input)?; Ok((res, bit != 0)) diff --git a/src/bits/streaming.rs b/src/bits/streaming.rs index 892fd328d..a7c8d0a67 100644 --- a/src/bits/streaming.rs +++ b/src/bits/streaming.rs @@ -95,8 +95,8 @@ where /// assert_eq!(parse(([0b10000000].as_ref(), 1)), Ok((([0b10000000].as_ref(), 2), false))); /// ``` pub fn bool>(input: (I, usize)) -> IResult<(I, usize), bool, E> - where - I: Slice> + InputIter + InputLength, +where + I: Slice> + InputIter + InputLength, { let (res, bit): (_, u32) = take(1usize)(input)?; Ok((res, bit != 0)) @@ -165,9 +165,6 @@ mod test { let result: crate::IResult<(&[u8], usize), bool> = bool((input, 8)); - assert_eq!( - result, - Err(crate::Err::Incomplete(Needed::new(1))) - ); + assert_eq!(result, Err(crate::Err::Incomplete(Needed::new(1)))); } } diff --git a/src/character/complete.rs b/src/character/complete.rs index a98bafbb7..7cb760a68 100644 --- a/src/character/complete.rs +++ b/src/character/complete.rs @@ -414,10 +414,10 @@ where /// assert_eq!(parser("c1"), Err(Err::Error(Error::new("c1", ErrorKind::Digit)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Digit)))); /// ``` -/// +/// /// ## Parsing an integer /// You can use `digit1` in combination with [`map_res`] to parse an integer: -/// +/// /// ``` /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed}; /// # use nom::combinator::map_res; @@ -425,12 +425,12 @@ where /// fn parser(input: &str) -> IResult<&str, u32> { /// map_res(digit1, str::parse)(input) /// } -/// +/// /// assert_eq!(parser("416"), Ok(("", 416))); /// assert_eq!(parser("12b"), Ok(("b", 12))); /// assert!(parser("b").is_err()); /// ``` -/// +/// /// [`map_res`]: crate::combinator::map_res pub fn digit1>(input: T) -> IResult where diff --git a/src/sequence/tests.rs b/src/sequence/tests.rs index ea662607d..30ad0d678 100644 --- a/src/sequence/tests.rs +++ b/src/sequence/tests.rs @@ -1,6 +1,6 @@ use super::*; use crate::bytes::streaming::{tag, take}; -use crate::error::{ErrorKind, Error}; +use crate::error::{Error, ErrorKind}; use crate::internal::{Err, IResult, Needed}; use crate::number::streaming::be_u16; @@ -275,7 +275,16 @@ fn tuple_test() { #[test] fn unit_type() { - assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())("abxsbsh"), Ok(("abxsbsh", ()))); - assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())("sdfjakdsas"), Ok(("sdfjakdsas", ()))); - assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())(""), Ok(("", ()))); + assert_eq!( + tuple::<&'static str, (), Error<&'static str>, ()>(())("abxsbsh"), + Ok(("abxsbsh", ())) + ); + assert_eq!( + tuple::<&'static str, (), Error<&'static str>, ()>(())("sdfjakdsas"), + Ok(("sdfjakdsas", ())) + ); + assert_eq!( + tuple::<&'static str, (), Error<&'static str>, ()>(())(""), + Ok(("", ())) + ); }