Skip to content

Commit 6be62d3

Browse files
authored
v7.1.2 (#1605)
1 parent 6860641 commit 6be62d3

File tree

6 files changed

+82
-18
lines changed

6 files changed

+82
-18
lines changed

CHANGELOG.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,61 @@
66

77
### Changed
88

9+
## 7.1.2 - 2023-01-01
10+
11+
### Thanks
12+
13+
- @joubs
14+
- @Fyko
15+
- @LoganDark
16+
- @darnuria
17+
- @jkugelman
18+
- @barower
19+
- @puzzlewolf
20+
- @epage
21+
- @cky
22+
- @wolthom
23+
- @w1ll-i-code
24+
25+
### Changed
26+
27+
- documentation fixes
28+
- tests fixes
29+
- limit the initial capacity of the result vector of `many_m_n` to 64kiB
30+
- bits parser now accept `Parser` implementors instead of only functions
31+
32+
### Added
33+
34+
- implement `Tuple` parsing for the unit type as a special case
35+
- implement `ErrorConvert` on the unit type to make it usable as error type for bits parsers
36+
- bool parser for bits input
37+
38+
## 7.1.1 - 2022-03-14
39+
40+
### Thanks
41+
42+
- @ThomasdenH
43+
- @@SphinxKnight
44+
- @irevoire
45+
- @doehyunbaek
46+
- @pxeger
47+
- @punkeel
48+
- @max-sixty
49+
- @Xiretza
50+
- @5c077m4n
51+
- @erihsu
52+
- @TheNeikos
53+
- @LoganDark
54+
- @nickelc
55+
- @chotchki
56+
- @ctrlcctrlv
57+
58+
59+
### Changed
60+
61+
- documentation fixes
62+
- more examples
63+
964
## 7.1.0 - 2021-11-04
1065

1166
### Thanks
@@ -1420,7 +1475,10 @@ Considering the number of changes since the last release, this version can conta
14201475

14211476
## Compare code
14221477

1423-
* [unreleased](https://github.com/Geal/nom/compare/7.0.0...HEAD)
1478+
* [unreleased](https://github.com/Geal/nom/compare/7.1.2...HEAD)
1479+
* [7.1.2](https://github.com/Geal/nom/compare/7.1.1...7.1.2)
1480+
* [7.1.1](https://github.com/Geal/nom/compare/7.1.0...7.1.1)
1481+
* [7.1.0](https://github.com/Geal/nom/compare/7.0.0...7.1.0)
14241482
* [7.0.0](https://github.com/Geal/nom/compare/6.2.1...7.0.0)
14251483
* [6.2.1](https://github.com/Geal/nom/compare/6.2.0...6.2.1)
14261484
* [6.2.0](https://github.com/Geal/nom/compare/6.1.2...6.2.0)

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "nom"
4-
version = "7.1.1"
4+
version = "7.1.2"
55
authors = [ "[email protected]" ]
66
description = "A byte-oriented, zero-copy, parser combinators library"
77
license = "MIT"

src/bits/complete.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ where
121121
/// assert_eq!(parse(([0b10000000].as_ref(), 1)), Ok((([0b10000000].as_ref(), 2), false)));
122122
/// ```
123123
pub fn bool<I, E: ParseError<(I, usize)>>(input: (I, usize)) -> IResult<(I, usize), bool, E>
124-
where
125-
I: Slice<RangeFrom<usize>> + InputIter<Item = u8> + InputLength,
124+
where
125+
I: Slice<RangeFrom<usize>> + InputIter<Item = u8> + InputLength,
126126
{
127127
let (res, bit): (_, u32) = take(1usize)(input)?;
128128
Ok((res, bit != 0))

src/bits/streaming.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ where
9595
/// assert_eq!(parse(([0b10000000].as_ref(), 1)), Ok((([0b10000000].as_ref(), 2), false)));
9696
/// ```
9797
pub fn bool<I, E: ParseError<(I, usize)>>(input: (I, usize)) -> IResult<(I, usize), bool, E>
98-
where
99-
I: Slice<RangeFrom<usize>> + InputIter<Item = u8> + InputLength,
98+
where
99+
I: Slice<RangeFrom<usize>> + InputIter<Item = u8> + InputLength,
100100
{
101101
let (res, bit): (_, u32) = take(1usize)(input)?;
102102
Ok((res, bit != 0))
@@ -165,9 +165,6 @@ mod test {
165165

166166
let result: crate::IResult<(&[u8], usize), bool> = bool((input, 8));
167167

168-
assert_eq!(
169-
result,
170-
Err(crate::Err::Incomplete(Needed::new(1)))
171-
);
168+
assert_eq!(result, Err(crate::Err::Incomplete(Needed::new(1))));
172169
}
173170
}

src/character/complete.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -414,23 +414,23 @@ where
414414
/// assert_eq!(parser("c1"), Err(Err::Error(Error::new("c1", ErrorKind::Digit))));
415415
/// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Digit))));
416416
/// ```
417-
///
417+
///
418418
/// ## Parsing an integer
419419
/// You can use `digit1` in combination with [`map_res`] to parse an integer:
420-
///
420+
///
421421
/// ```
422422
/// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
423423
/// # use nom::combinator::map_res;
424424
/// # use nom::character::complete::digit1;
425425
/// fn parser(input: &str) -> IResult<&str, u32> {
426426
/// map_res(digit1, str::parse)(input)
427427
/// }
428-
///
428+
///
429429
/// assert_eq!(parser("416"), Ok(("", 416)));
430430
/// assert_eq!(parser("12b"), Ok(("b", 12)));
431431
/// assert!(parser("b").is_err());
432432
/// ```
433-
///
433+
///
434434
/// [`map_res`]: crate::combinator::map_res
435435
pub fn digit1<T, E: ParseError<T>>(input: T) -> IResult<T, T, E>
436436
where

src/sequence/tests.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22
use crate::bytes::streaming::{tag, take};
3-
use crate::error::{ErrorKind, Error};
3+
use crate::error::{Error, ErrorKind};
44
use crate::internal::{Err, IResult, Needed};
55
use crate::number::streaming::be_u16;
66

@@ -275,7 +275,16 @@ fn tuple_test() {
275275

276276
#[test]
277277
fn unit_type() {
278-
assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())("abxsbsh"), Ok(("abxsbsh", ())));
279-
assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())("sdfjakdsas"), Ok(("sdfjakdsas", ())));
280-
assert_eq!(tuple::<&'static str, (), Error<&'static str>, ()>(())(""), Ok(("", ())));
278+
assert_eq!(
279+
tuple::<&'static str, (), Error<&'static str>, ()>(())("abxsbsh"),
280+
Ok(("abxsbsh", ()))
281+
);
282+
assert_eq!(
283+
tuple::<&'static str, (), Error<&'static str>, ()>(())("sdfjakdsas"),
284+
Ok(("sdfjakdsas", ()))
285+
);
286+
assert_eq!(
287+
tuple::<&'static str, (), Error<&'static str>, ()>(())(""),
288+
Ok(("", ()))
289+
);
281290
}

0 commit comments

Comments
 (0)