From f790be8aaf71cc125a3e0fc366e94ae2bd406ba1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 12 Dec 2022 10:59:52 -0600 Subject: [PATCH] fix: Deprecate streaming/complete-specific parsers --- src/bits/complete.rs | 4 + src/bits/streaming.rs | 10 ++ src/bytes/complete.rs | 19 ++++ src/bytes/streaming.rs | 58 +++++++++++ src/character/complete.rs | 35 +++++++ src/character/mod.rs | 2 + src/character/streaming.rs | 98 +++++++++++++++++++ src/number/complete.rs | 56 +++++++++++ src/number/mod.rs | 2 + src/number/streaming.rs | 191 +++++++++++++++++++++++++++++++++++++ src/number/tests.rs | 2 + 11 files changed, 477 insertions(+) diff --git a/src/bits/complete.rs b/src/bits/complete.rs index 406d3ed2..a4db7fb0 100644 --- a/src/bits/complete.rs +++ b/src/bits/complete.rs @@ -1,6 +1,8 @@ //! Bit level parsers //! +#![allow(deprecated)] + use crate::error::{ErrorKind, ParseError}; use crate::input::{InputIter, InputLength, Slice, ToUsize}; use crate::lib::std::ops::{AddAssign, Div, RangeFrom, Shl, Shr}; @@ -30,6 +32,7 @@ use crate::{Err, IResult}; /// // Tries to consume 12 bits but only 8 are available /// assert_eq!(parser(([0b00010010].as_ref(), 0), 12), Err(nom::Err::Error(Error{input: ([0b00010010].as_ref(), 0), code: ErrorKind::Eof }))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bits::take`")] pub fn take>( count: C, ) -> impl Fn((I, usize)) -> IResult<(I, usize), O, E> @@ -91,6 +94,7 @@ where } /// Generates a parser taking `count` bits and comparing them to `pattern` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bits::tag`")] pub fn tag>( pattern: O, count: C, diff --git a/src/bits/streaming.rs b/src/bits/streaming.rs index 99089b01..977e09fb 100644 --- a/src/bits/streaming.rs +++ b/src/bits/streaming.rs @@ -1,12 +1,18 @@ //! Bit level parsers //! +#![allow(deprecated)] + use crate::error::{ErrorKind, ParseError}; use crate::input::{InputIter, InputLength, Slice, ToUsize}; use crate::lib::std::ops::{AddAssign, Div, RangeFrom, Shl, Shr}; use crate::{Err, IResult, Needed}; /// Generates a parser taking `count` bits +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bits::take` with input wrapped in `nom::input::Streaming`" +)] pub fn take>( count: C, ) -> impl Fn((I, usize)) -> IResult<(I, usize), O, E> @@ -65,6 +71,10 @@ where } /// Generates a parser taking `count` bits and comparing them to `pattern` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bits::tag` with input wrapped in `nom::input::Streaming`" +)] pub fn tag>( pattern: O, count: C, diff --git a/src/bytes/complete.rs b/src/bytes/complete.rs index a935b1d4..266d7978 100644 --- a/src/bytes/complete.rs +++ b/src/bytes/complete.rs @@ -1,5 +1,7 @@ //! Parsers recognizing bytes streams, complete input version +#![allow(deprecated)] + use crate::error::ErrorKind; use crate::error::ParseError; use crate::input::{ @@ -30,6 +32,7 @@ use crate::{Err, IResult, Parser}; /// assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Tag)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::tag`")] pub fn tag>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -82,6 +85,7 @@ where /// assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Tag)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::tag_no_case`")] pub fn tag_no_case>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -135,6 +139,7 @@ where /// assert_eq!(not_space("Nospace"), Ok(("", "Nospace"))); /// assert_eq!(not_space(""), Err(Err::Error(Error::new("", ErrorKind::IsNot)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::is_not`")] pub fn is_not>( arr: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -181,6 +186,7 @@ where /// assert_eq!(hex("D15EA5E"), Ok(("", "D15EA5E"))); /// assert_eq!(hex(""), Err(Err::Error(Error::new("", ErrorKind::IsA)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::is_a`")] pub fn is_a>( arr: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -225,6 +231,7 @@ where /// assert_eq!(alpha(b"latin"), Ok((&b""[..], &b"latin"[..]))); /// assert_eq!(alpha(b""), Ok((&b""[..], &b""[..]))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_while`")] pub fn take_while>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -268,6 +275,7 @@ where /// assert_eq!(alpha(b"latin"), Ok((&b""[..], &b"latin"[..]))); /// assert_eq!(alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhile1)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_while1`")] pub fn take_while1>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -315,6 +323,7 @@ where /// assert_eq!(short_alpha(b"ed"), Err(Err::Error(Error::new(&b"ed"[..], ErrorKind::TakeWhileMN)))); /// assert_eq!(short_alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhileMN)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_while_m_n`")] pub fn take_while_m_n>( m: usize, n: usize, @@ -407,6 +416,7 @@ where /// assert_eq!(till_colon("12345"), Ok(("", "12345"))); /// assert_eq!(till_colon(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_till`")] pub fn take_till>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -451,6 +461,7 @@ where /// assert_eq!(till_colon("12345"), Ok(("", "12345"))); /// assert_eq!(till_colon(""), Err(Err::Error(Error::new("", ErrorKind::TakeTill1)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_till1`")] pub fn take_till1>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -504,6 +515,7 @@ where /// assert_eq!(take::<_, _, Error<_>>(1usize)("💙"), Ok(("", "💙"))); /// assert_eq!(take::<_, _, Error<_>>(1usize)("💙".as_bytes()), Ok((b"\x9F\x92\x99".as_ref(), b"\xF0".as_ref()))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take`")] pub fn take>( count: C, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -548,6 +560,7 @@ where /// assert_eq!(until_eof(""), Err(Err::Error(Error::new("", ErrorKind::TakeUntil)))); /// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1"))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_until`")] pub fn take_until>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -594,6 +607,7 @@ where /// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1"))); /// assert_eq!(until_eof("eof"), Err(Err::Error(Error::new("eof", ErrorKind::TakeUntil)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::take_until1`")] pub fn take_until1>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -642,6 +656,7 @@ where /// assert_eq!(esc(r#"12\"34;"#), Ok((";", r#"12\"34"#))); /// ``` /// +#[deprecated(since = "8.0.0", note = "Replaced with `nom::bytes::escaped`")] pub fn escaped<'a, Input: 'a, Error, F, G, O1, O2>( mut normal: F, control_char: char, @@ -777,6 +792,10 @@ where /// assert_eq!(parser("ab\\ncd"), Ok(("", String::from("ab\ncd")))); /// ``` #[cfg(feature = "alloc")] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::escaped_transform`" +)] pub fn escaped_transform( mut normal: F, control_char: char, diff --git a/src/bytes/streaming.rs b/src/bytes/streaming.rs index 62ba73b1..84fc6205 100644 --- a/src/bytes/streaming.rs +++ b/src/bytes/streaming.rs @@ -1,5 +1,7 @@ //! Parsers recognizing bytes streams, streaming version +#![allow(deprecated)] + use crate::error::ErrorKind; use crate::error::ParseError; use crate::input::{ @@ -29,6 +31,10 @@ use crate::{Err, IResult, Needed, Parser}; /// assert_eq!(parser("S"), Err(Err::Error(Error::new("S", ErrorKind::Tag)))); /// assert_eq!(parser("H"), Err(Err::Incomplete(Needed::new(4)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::tag` with input wrapped in `nom::input::Streaming`" +)] pub fn tag>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -81,6 +87,10 @@ where /// assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag)))); /// assert_eq!(parser(""), Err(Err::Incomplete(Needed::new(5)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::tag_no_case` with input wrapped in `nom::input::Streaming`" +)] pub fn tag_no_case>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -135,6 +145,10 @@ where /// assert_eq!(not_space("Nospace"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(not_space(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::is_not` with input wrapped in `nom::input::Streaming`" +)] pub fn is_not>( arr: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -183,6 +197,10 @@ where /// assert_eq!(hex("D15EA5E"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(hex(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::is_a` with input wrapped in `nom::input::Streaming`" +)] pub fn is_a>( arr: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -230,6 +248,10 @@ where /// assert_eq!(alpha(b"latin"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(alpha(b""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_while` with input wrapped in `nom::input::Streaming`" +)] pub fn take_while>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -277,6 +299,10 @@ where /// assert_eq!(alpha(b"latin"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhile1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_while1` with input wrapped in `nom::input::Streaming`" +)] pub fn take_while1>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -327,6 +353,10 @@ where /// assert_eq!(short_alpha(b"ed"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(short_alpha(b"12345"), Err(Err::Error(Error::new(&b"12345"[..], ErrorKind::TakeWhileMN)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_while_m_n` with input wrapped in `nom::input::Streaming`" +)] pub fn take_while_m_n>( m: usize, n: usize, @@ -423,6 +453,10 @@ where /// assert_eq!(till_colon("12345"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(till_colon(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_till` with input wrapped in `nom::input::Streaming`" +)] pub fn take_till>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -468,6 +502,10 @@ where /// assert_eq!(till_colon("12345"), Err(Err::Incomplete(Needed::new(1)))); /// assert_eq!(till_colon(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_till1` with input wrapped in `nom::input::Streaming`" +)] pub fn take_till1>( cond: F, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -515,6 +553,10 @@ where /// assert_eq!(take6("things"), Ok(("", "things"))); /// assert_eq!(take6("short"), Err(Err::Incomplete(Needed::Unknown))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take` with input wrapped in `nom::input::Streaming`" +)] pub fn take>( count: C, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -562,6 +604,10 @@ where /// assert_eq!(until_eof("hello, worldeo"), Err(Err::Incomplete(Needed::Unknown))); /// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1"))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_until` with input wrapped in `nom::input::Streaming`" +)] pub fn take_until>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -610,6 +656,10 @@ where /// assert_eq!(until_eof("1eof2eof"), Ok(("eof2eof", "1"))); /// assert_eq!(until_eof("eof"), Err(Err::Error(Error::new("eof", ErrorKind::TakeUntil)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::take_until1` with input wrapped in `nom::input::Streaming`" +)] pub fn take_until1>( tag: T, ) -> impl Fn(Input) -> IResult::Output, Error> @@ -657,6 +707,10 @@ where /// assert_eq!(esc("12\\\"34;"), Ok((";", "12\\\"34"))); /// ``` /// +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::escaped` with input wrapped in `nom::input::Streaming`" +)] pub fn escaped( mut normal: F, control_char: char, @@ -780,6 +834,10 @@ where /// assert_eq!(parser("ab\\\"cd\""), Ok(("\"", String::from("ab\"cd")))); /// ``` #[cfg(feature = "alloc")] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::bytes::escaped_transform` with input wrapped in `nom::input::Streaming`" +)] pub fn escaped_transform( mut normal: F, control_char: char, diff --git a/src/character/complete.rs b/src/character/complete.rs index 3184c6d1..0402d2cb 100644 --- a/src/character/complete.rs +++ b/src/character/complete.rs @@ -2,6 +2,8 @@ //! //! Functions recognizing specific characters. +#![allow(deprecated)] + use crate::branch::alt; use crate::combinator::opt; use crate::error::ErrorKind; @@ -30,6 +32,7 @@ use crate::{Err, IResult}; /// assert_eq!(parser("bc"), Err(Err::Error(Error::new("bc", ErrorKind::Char)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::char`")] pub fn char>(c: char) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -67,6 +70,7 @@ where /// assert_eq!(parser("cd"), Err(Err::Error(Error::new("cd", ErrorKind::Satisfy)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Satisfy)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::satisfy`")] pub fn satisfy>(cond: F) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -107,6 +111,7 @@ where /// assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")("bc"), Err(Err::Error(("bc", ErrorKind::OneOf)))); /// assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")(""), Err(Err::Error(("", ErrorKind::OneOf)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::one_of`")] pub fn one_of>(list: T) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -140,6 +145,7 @@ where /// assert_eq!(none_of::<_, _, (&str, ErrorKind)>("ab")("a"), Err(Err::Error(("a", ErrorKind::NoneOf)))); /// assert_eq!(none_of::<_, _, (&str, ErrorKind)>("a")(""), Err(Err::Error(("", ErrorKind::NoneOf)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::none_of`")] pub fn none_of>(list: T) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -180,6 +186,7 @@ where /// assert_eq!(parser("ab\r\nc"), Err(Err::Error(Error::new("ab\r\nc", ErrorKind::CrLf)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::CrLf)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::crlf`")] pub fn crlf>(input: T) -> IResult::Output, E> where T: Slice> + Slice>, @@ -217,6 +224,10 @@ where /// assert_eq!(parser("a\rb\nc"), Err(Err::Error(Error { input: "a\rb\nc", code: ErrorKind::Tag }))); /// assert_eq!(parser("a\rbc"), Err(Err::Error(Error { input: "a\rbc", code: ErrorKind::Tag }))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::not_line_ending`" +)] pub fn not_line_ending>(input: T) -> IResult::Output, E> where T: Slice> + Slice> + Slice>, @@ -268,6 +279,7 @@ where /// assert_eq!(parser("ab\r\nc"), Err(Err::Error(Error::new("ab\r\nc", ErrorKind::CrLf)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::CrLf)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::line_ending`")] pub fn line_ending>(input: T) -> IResult::Output, E> where T: Slice> + Slice> + Slice>, @@ -304,6 +316,7 @@ where /// assert_eq!(parser("\r\nc"), Err(Err::Error(Error::new("\r\nc", ErrorKind::Char)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::newline`")] pub fn newline>(input: I) -> IResult where I: Slice> + InputIter, @@ -328,6 +341,7 @@ where /// assert_eq!(parser("\r\nc"), Err(Err::Error(Error::new("\r\nc", ErrorKind::Char)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::tab`")] pub fn tab>(input: I) -> IResult where I: Slice> + InputIter, @@ -351,6 +365,7 @@ where /// assert_eq!(parser("abc"), Ok(("bc",'a'))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Eof)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::anychar`")] pub fn anychar>(input: T) -> IResult where T: InputIter + InputLength + Slice>, @@ -383,6 +398,7 @@ where /// assert_eq!(parser("1c"), Ok(("1c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::alpha0`")] pub fn alpha0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -411,6 +427,7 @@ where /// assert_eq!(parser("1c"), Err(Err::Error(Error::new("1c", ErrorKind::Alpha)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Alpha)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::alpha1`")] pub fn alpha1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -440,6 +457,7 @@ where /// assert_eq!(parser("a21c"), Ok(("a21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::digit0`")] pub fn digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -486,6 +504,7 @@ where /// ``` /// /// [`map_res`]: crate::combinator::map_res +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::digit1`")] pub fn digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -513,6 +532,7 @@ where /// assert_eq!(parser("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::hex_digit0`")] pub fn hex_digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -540,6 +560,7 @@ where /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::HexDigit)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::HexDigit)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::hex_digit1`")] pub fn hex_digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -568,6 +589,7 @@ where /// assert_eq!(parser("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::oct_digit0`")] pub fn oct_digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -596,6 +618,7 @@ where /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::OctDigit)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::OctDigit)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::oct_digit1`")] pub fn oct_digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -624,6 +647,10 @@ where /// assert_eq!(parser("&Z21c"), Ok(("&Z21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alphanumeric0`" +)] pub fn alphanumeric0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -652,6 +679,10 @@ where /// assert_eq!(parser("&H2"), Err(Err::Error(Error::new("&H2", ErrorKind::AlphaNumeric)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::AlphaNumeric)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alphanumeric1`" +)] pub fn alphanumeric1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -680,6 +711,7 @@ where /// assert_eq!(parser("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::space0`")] pub fn space0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -711,6 +743,7 @@ where /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::Space)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Space)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::space1`")] pub fn space1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -745,6 +778,7 @@ where /// assert_eq!(parser("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(parser(""), Ok(("", ""))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::multispace0`")] pub fn multispace0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -776,6 +810,7 @@ where /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::MultiSpace)))); /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::MultiSpace)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::character::multispace1`")] pub fn multispace1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, diff --git a/src/character/mod.rs b/src/character/mod.rs index 56521be4..500e61e9 100644 --- a/src/character/mod.rs +++ b/src/character/mod.rs @@ -2,6 +2,8 @@ //! //! Functions recognizing specific characters +#![allow(deprecated)] // will just become `pub(crate)` later + pub mod complete; pub mod streaming; #[cfg(test)] diff --git a/src/character/streaming.rs b/src/character/streaming.rs index de2d4cea..b307f7b3 100644 --- a/src/character/streaming.rs +++ b/src/character/streaming.rs @@ -2,6 +2,8 @@ //! //! Functions recognizing specific characters +#![allow(deprecated)] + use crate::branch::alt; use crate::combinator::opt; use crate::error::ErrorKind; @@ -29,6 +31,10 @@ use crate::{Err, IResult, Needed}; /// assert_eq!(parser("bc"), Err(Err::Error(Error::new("bc", ErrorKind::Char)))); /// assert_eq!(parser(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::char` with input wrapped in `nom::input::Streaming`" +)] pub fn char>(c: char) -> impl Fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -67,6 +73,10 @@ where /// assert_eq!(parser("cd"), Err(Err::Error(Error::new("cd", ErrorKind::Satisfy)))); /// assert_eq!(parser(""), Err(Err::Incomplete(Needed::Unknown))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::satisfy` with input wrapped in `nom::input::Streaming`" +)] pub fn satisfy>(cond: F) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -108,6 +118,10 @@ where /// assert_eq!(one_of::<_, _, (_, ErrorKind)>("a")("bc"), Err(Err::Error(("bc", ErrorKind::OneOf)))); /// assert_eq!(one_of::<_, _, (_, ErrorKind)>("a")(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::one_of` with input wrapped in `nom::input::Streaming`" +)] pub fn one_of>(list: T) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -142,6 +156,10 @@ where /// assert_eq!(none_of::<_, _, (_, ErrorKind)>("ab")("a"), Err(Err::Error(("a", ErrorKind::NoneOf)))); /// assert_eq!(none_of::<_, _, (_, ErrorKind)>("a")(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::none_of` with input wrapped in `nom::input::Streaming`" +)] pub fn none_of>(list: T) -> impl Fn(I) -> IResult where I: Slice> + InputIter, @@ -179,6 +197,10 @@ where /// assert_eq!(crlf::<_, (_, ErrorKind)>("ab\r\nc"), Err(Err::Error(("ab\r\nc", ErrorKind::CrLf)))); /// assert_eq!(crlf::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(2)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::crlf` with input wrapped in `nom::input::Streaming`" +)] pub fn crlf>(input: T) -> IResult::Output, E> where T: Slice> + Slice> + Slice>, @@ -211,6 +233,10 @@ where /// assert_eq!(not_line_ending::<_, (_, ErrorKind)>("a\rb\nc"), Err(Err::Error(("a\rb\nc", ErrorKind::Tag )))); /// assert_eq!(not_line_ending::<_, (_, ErrorKind)>("a\rbc"), Err(Err::Error(("a\rbc", ErrorKind::Tag )))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::not_line_ending` with input wrapped in `nom::input::Streaming`" +)] pub fn not_line_ending>(input: T) -> IResult::Output, E> where T: Slice> + Slice> + Slice>, @@ -259,6 +285,10 @@ where /// assert_eq!(line_ending::<_, (_, ErrorKind)>("ab\r\nc"), Err(Err::Error(("ab\r\nc", ErrorKind::CrLf)))); /// assert_eq!(line_ending::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::line_ending` with input wrapped in `nom::input::Streaming`" +)] pub fn line_ending>(input: T) -> IResult::Output, E> where T: Slice> + Slice> + Slice>, @@ -292,6 +322,10 @@ where /// assert_eq!(newline::<_, (_, ErrorKind)>("\r\nc"), Err(Err::Error(("\r\nc", ErrorKind::Char)))); /// assert_eq!(newline::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::newline` with input wrapped in `nom::input::Streaming`" +)] pub fn newline>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -312,6 +346,10 @@ where /// assert_eq!(tab::<_, (_, ErrorKind)>("\r\nc"), Err(Err::Error(("\r\nc", ErrorKind::Char)))); /// assert_eq!(tab::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::tab` with input wrapped in `nom::input::Streaming`" +)] pub fn tab>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -331,6 +369,10 @@ where /// assert_eq!(anychar::<_, (_, ErrorKind)>("abc"), Ok(("bc",'a'))); /// assert_eq!(anychar::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::anychar` with input wrapped in `nom::input::Streaming`" +)] pub fn anychar>(input: T) -> IResult where T: InputIter + InputLength + Slice>, @@ -359,6 +401,10 @@ where /// assert_eq!(alpha0::<_, (_, ErrorKind)>("1c"), Ok(("1c", ""))); /// assert_eq!(alpha0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alpha0` with input wrapped in `nom::input::Streaming`" +)] pub fn alpha0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -383,6 +429,10 @@ where /// assert_eq!(alpha1::<_, (_, ErrorKind)>("1c"), Err(Err::Error(("1c", ErrorKind::Alpha)))); /// assert_eq!(alpha1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alpha1` with input wrapped in `nom::input::Streaming`" +)] pub fn alpha1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -407,6 +457,10 @@ where /// assert_eq!(digit0::<_, (_, ErrorKind)>("a21c"), Ok(("a21c", ""))); /// assert_eq!(digit0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::digit0` with input wrapped in `nom::input::Streaming`" +)] pub fn digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -431,6 +485,10 @@ where /// assert_eq!(digit1::<_, (_, ErrorKind)>("c1"), Err(Err::Error(("c1", ErrorKind::Digit)))); /// assert_eq!(digit1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::digit1` with input wrapped in `nom::input::Streaming`" +)] pub fn digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -455,6 +513,10 @@ where /// assert_eq!(hex_digit0::<_, (_, ErrorKind)>("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(hex_digit0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::hex_digit0` with input wrapped in `nom::input::Streaming`" +)] pub fn hex_digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -479,6 +541,10 @@ where /// assert_eq!(hex_digit1::<_, (_, ErrorKind)>("H2"), Err(Err::Error(("H2", ErrorKind::HexDigit)))); /// assert_eq!(hex_digit1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::hex_digit1` with input wrapped in `nom::input::Streaming`" +)] pub fn hex_digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -503,6 +569,10 @@ where /// assert_eq!(oct_digit0::<_, (_, ErrorKind)>("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(oct_digit0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::oct_digit0` with input wrapped in `nom::input::Streaming`" +)] pub fn oct_digit0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -527,6 +597,10 @@ where /// assert_eq!(oct_digit1::<_, (_, ErrorKind)>("H2"), Err(Err::Error(("H2", ErrorKind::OctDigit)))); /// assert_eq!(oct_digit1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::oct_digit1` with input wrapped in `nom::input::Streaming`" +)] pub fn oct_digit1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -551,6 +625,10 @@ where /// assert_eq!(alphanumeric0::<_, (_, ErrorKind)>("&Z21c"), Ok(("&Z21c", ""))); /// assert_eq!(alphanumeric0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alphanumeric0` with input wrapped in `nom::input::Streaming`" +)] pub fn alphanumeric0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -575,6 +653,10 @@ where /// assert_eq!(alphanumeric1::<_, (_, ErrorKind)>("&H2"), Err(Err::Error(("&H2", ErrorKind::AlphaNumeric)))); /// assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::alphanumeric1` with input wrapped in `nom::input::Streaming`" +)] pub fn alphanumeric1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -599,6 +681,10 @@ where /// assert_eq!(space0::<_, (_, ErrorKind)>("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(space0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::space0` with input wrapped in `nom::input::Streaming`" +)] pub fn space0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -625,6 +711,10 @@ where /// assert_eq!(space1::<_, (_, ErrorKind)>("H2"), Err(Err::Error(("H2", ErrorKind::Space)))); /// assert_eq!(space1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::space1` with input wrapped in `nom::input::Streaming`" +)] pub fn space1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -655,6 +745,10 @@ where /// assert_eq!(multispace0::<_, (_, ErrorKind)>("Z21c"), Ok(("Z21c", ""))); /// assert_eq!(multispace0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::multispace0` with input wrapped in `nom::input::Streaming`" +)] pub fn multispace0>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, @@ -682,6 +776,10 @@ where /// assert_eq!(multispace1::<_, (_, ErrorKind)>("H2"), Err(Err::Error(("H2", ErrorKind::MultiSpace)))); /// assert_eq!(multispace1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::character::multispace1` with input wrapped in `nom::input::Streaming`" +)] pub fn multispace1>(input: T) -> IResult::Output, E> where T: InputTakeAtPosition, diff --git a/src/number/complete.rs b/src/number/complete.rs index ceb64972..06b592d2 100644 --- a/src/number/complete.rs +++ b/src/number/complete.rs @@ -1,5 +1,7 @@ //! Parsers recognizing numbers, complete input version +#![allow(deprecated)] + use crate::branch::alt; use crate::bytes::complete::tag; use crate::character::complete::{char, digit1, sign}; @@ -30,6 +32,7 @@ use crate::*; /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u8`")] pub fn be_u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -60,6 +63,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u16`")] pub fn be_u16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -93,6 +97,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u24`")] pub fn be_u24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -126,6 +131,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u32`")] pub fn be_u32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -159,6 +165,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u64`")] pub fn be_u64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -192,6 +199,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_u128`")] pub fn be_u128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -225,6 +233,7 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i8`")] pub fn be_i8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -248,6 +257,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i16`")] pub fn be_i16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -271,6 +281,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i24`")] pub fn be_i24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -303,6 +314,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i32`")] pub fn be_i32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -326,6 +338,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i64`")] pub fn be_i64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -349,6 +362,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_i128`")] pub fn be_i128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -372,6 +386,7 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u8`")] pub fn le_u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -402,6 +417,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u16`")] pub fn le_u16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -435,6 +451,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u24`")] pub fn le_u24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -468,6 +485,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u32`")] pub fn le_u32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -501,6 +519,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u64`")] pub fn le_u64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -534,6 +553,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_u128`")] pub fn le_u128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -567,6 +587,7 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i8`")] pub fn le_i8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -590,6 +611,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i16`")] pub fn le_i16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -613,6 +635,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i24`")] pub fn le_i24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -645,6 +668,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i32`")] pub fn le_i32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -668,6 +692,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i64`")] pub fn le_i64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -691,6 +716,7 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_i128`")] pub fn le_i128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -715,6 +741,7 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u8`")] pub fn u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -755,6 +782,7 @@ where /// assert_eq!(le_u16(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u16`")] pub fn u16>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -794,6 +822,7 @@ where /// assert_eq!(le_u24(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u24`")] pub fn u24>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -833,6 +862,7 @@ where /// assert_eq!(le_u32(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u32`")] pub fn u32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -872,6 +902,7 @@ where /// assert_eq!(le_u64(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u64`")] pub fn u64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -911,6 +942,7 @@ where /// assert_eq!(le_u128(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::u128`")] pub fn u128>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -942,6 +974,7 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Error((&[][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i8`")] pub fn i8>(i: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -974,6 +1007,7 @@ where /// assert_eq!(le_i16(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i16`")] pub fn i16>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1013,6 +1047,7 @@ where /// assert_eq!(le_i24(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i24`")] pub fn i24>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1052,6 +1087,7 @@ where /// assert_eq!(le_i32(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i32`")] pub fn i32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1091,6 +1127,7 @@ where /// assert_eq!(le_i64(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i64`")] pub fn i64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1130,6 +1167,7 @@ where /// assert_eq!(le_i128(&b"\x01"[..]), Err(Err::Error((&[0x01][..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::i128`")] pub fn i128>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1160,6 +1198,7 @@ where /// assert_eq!(parser(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_f32`")] pub fn be_f32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1186,6 +1225,7 @@ where /// assert_eq!(parser(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::be_f64`")] pub fn be_f64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1212,6 +1252,7 @@ where /// assert_eq!(parser(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_f32`")] pub fn le_f32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1238,6 +1279,7 @@ where /// assert_eq!(parser(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::le_f64`")] pub fn le_f64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1273,6 +1315,7 @@ where /// assert_eq!(le_f32(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::f32`")] pub fn f32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1312,6 +1355,7 @@ where /// assert_eq!(le_f64(&b"abc"[..]), Err(Err::Error((&b"abc"[..], ErrorKind::Eof)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::f64`")] pub fn f64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1343,6 +1387,7 @@ where /// assert_eq!(parser(&b"ggg"[..]), Err(Err::Error((&b"ggg"[..], ErrorKind::IsA)))); /// ``` #[inline] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::hex_u32`")] pub fn hex_u32>(input: I) -> IResult where I: InputTakeAtPosition, @@ -1400,6 +1445,7 @@ where /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Char)))); /// ``` #[rustfmt::skip] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::recognize_float`")] pub fn recognize_float>(input: T) -> IResult::Output, E> where T: Slice> + Slice>, @@ -1428,6 +1474,10 @@ where // workaround until issues with minimal-lexical are fixed #[doc(hidden)] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::recognize_float_or_exceptions`" +)] pub fn recognize_float_or_exceptions>( input: T, ) -> IResult::Output, E> @@ -1470,6 +1520,10 @@ where /// /// *Complete version*: Can parse until the end of input. /// +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::recognize_float_parts`" +)] pub fn recognize_float_parts>( input: T, ) -> IResult< @@ -1591,6 +1645,7 @@ use crate::input::ParseTo; /// assert_eq!(parser("123K-01"), Ok(("K-01", 123.0))); /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Float)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::float`")] pub fn float>(input: T) -> IResult where T: Slice> + Slice> + Slice>, @@ -1646,6 +1701,7 @@ where /// assert_eq!(parser("123K-01"), Ok(("K-01", 123.0))); /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Float)))); /// ``` +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::double`")] pub fn double>(input: T) -> IResult where T: Slice> + Slice> + Slice>, diff --git a/src/number/mod.rs b/src/number/mod.rs index de7632d4..04382140 100644 --- a/src/number/mod.rs +++ b/src/number/mod.rs @@ -1,5 +1,7 @@ //! Parsers recognizing numbers +#![allow(deprecated)] // will just become `pub(crate)` later + pub mod complete; pub mod streaming; #[cfg(test)] diff --git a/src/number/streaming.rs b/src/number/streaming.rs index cb40a610..e5f5649b 100644 --- a/src/number/streaming.rs +++ b/src/number/streaming.rs @@ -1,5 +1,7 @@ //! Parsers recognizing numbers, streaming version +#![allow(deprecated)] + use crate::branch::alt; use crate::bytes::streaming::tag; use crate::character::streaming::{char, digit1, sign}; @@ -28,6 +30,10 @@ use crate::*; /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u8` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -58,6 +64,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u16` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -91,6 +101,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u24` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -124,6 +138,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u32` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -157,6 +175,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u64` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -189,6 +211,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_u128` with input wrapped in `nom::input::Streaming`" +)] pub fn be_u128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -219,6 +245,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i8` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -239,6 +269,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i16` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -259,6 +293,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i24` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -288,6 +326,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(4)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i32` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -309,6 +351,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i64` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -329,6 +375,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_i128` with input wrapped in `nom::input::Streaming`" +)] pub fn be_i128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -349,6 +399,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u8` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -379,6 +433,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u16` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -412,6 +470,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u24` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -445,6 +507,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u32` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -478,6 +544,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u64` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -511,6 +581,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_u128` with input wrapped in `nom::input::Streaming`" +)] pub fn le_u128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -541,6 +615,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i8` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -564,6 +642,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i16` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i16>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -587,6 +669,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i24` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i24>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -619,6 +705,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i32` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -642,6 +732,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i64` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -665,6 +759,10 @@ where /// assert_eq!(parser(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_i128` with input wrapped in `nom::input::Streaming`" +)] pub fn le_i128>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -689,6 +787,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u8` with input wrapped in `nom::input::Streaming`" +)] pub fn u8>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -729,6 +831,10 @@ where /// assert_eq!(le_u16(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u16` with input wrapped in `nom::input::Streaming`" +)] pub fn u16>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -768,6 +874,10 @@ where /// assert_eq!(le_u24(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u24` with input wrapped in `nom::input::Streaming`" +)] pub fn u24>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -807,6 +917,10 @@ where /// assert_eq!(le_u32(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u32` with input wrapped in `nom::input::Streaming`" +)] pub fn u32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -846,6 +960,10 @@ where /// assert_eq!(le_u64(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u64` with input wrapped in `nom::input::Streaming`" +)] pub fn u64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -885,6 +1003,10 @@ where /// assert_eq!(le_u128(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::u128` with input wrapped in `nom::input::Streaming`" +)] pub fn u128>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -916,6 +1038,10 @@ where /// assert_eq!(parser(&b""[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i8` with input wrapped in `nom::input::Streaming`" +)] pub fn i8>(i: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -948,6 +1074,10 @@ where /// assert_eq!(le_i16(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i16` with input wrapped in `nom::input::Streaming`" +)] pub fn i16>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -987,6 +1117,10 @@ where /// assert_eq!(le_i24(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(2)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i24` with input wrapped in `nom::input::Streaming`" +)] pub fn i24>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1026,6 +1160,10 @@ where /// assert_eq!(le_i32(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i32` with input wrapped in `nom::input::Streaming`" +)] pub fn i32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1065,6 +1203,10 @@ where /// assert_eq!(le_i64(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i64` with input wrapped in `nom::input::Streaming`" +)] pub fn i64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1104,6 +1246,10 @@ where /// assert_eq!(le_i128(&b"\x01"[..]), Err(Err::Incomplete(Needed::new(15)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::i128` with input wrapped in `nom::input::Streaming`" +)] pub fn i128>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1133,6 +1279,10 @@ where /// assert_eq!(parser(&[0x01][..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_f32` with input wrapped in `nom::input::Streaming`" +)] pub fn be_f32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1158,6 +1308,10 @@ where /// assert_eq!(parser(&[0x01][..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::be_f64` with input wrapped in `nom::input::Streaming`" +)] pub fn be_f64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1183,6 +1337,10 @@ where /// assert_eq!(parser(&[0x01][..]), Err(Err::Incomplete(Needed::new(3)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_f32` with input wrapped in `nom::input::Streaming`" +)] pub fn le_f32>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1208,6 +1366,10 @@ where /// assert_eq!(parser(&[0x01][..]), Err(Err::Incomplete(Needed::new(7)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::le_f64` with input wrapped in `nom::input::Streaming`" +)] pub fn le_f64>(input: I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1243,6 +1405,10 @@ where /// assert_eq!(le_f32(&b"abc"[..]), Err(Err::Incomplete(Needed::new(1)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::f32` with input wrapped in `nom::input::Streaming`" +)] pub fn f32>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1282,6 +1448,10 @@ where /// assert_eq!(le_f64(&b"abc"[..]), Err(Err::Incomplete(Needed::new(5)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::f64` with input wrapped in `nom::input::Streaming`" +)] pub fn f64>(endian: crate::number::Endianness) -> fn(I) -> IResult where I: Slice> + InputIter + InputLength, @@ -1312,6 +1482,10 @@ where /// assert_eq!(parser(&b"ggg"[..]), Err(Err::Error((&b"ggg"[..], ErrorKind::IsA)))); /// ``` #[inline] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::hex_u32` with input wrapped in `nom::input::Streaming`" +)] pub fn hex_u32>(input: I) -> IResult where I: InputTakeAtPosition, @@ -1368,6 +1542,7 @@ where /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Char)))); /// ``` #[rustfmt::skip] +#[deprecated(since = "8.0.0", note = "Replaced with `nom::number::recognize_float` with input wrapped in `nom::input::Streaming`")] pub fn recognize_float>(input: T) -> IResult::Output, E> where T: Slice> + Slice>, @@ -1396,6 +1571,10 @@ where // workaround until issues with minimal-lexical are fixed #[doc(hidden)] +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::recognize_float_or_exceptions` with input wrapped in `nom::input::Streaming`" +)] pub fn recognize_float_or_exceptions>( input: T, ) -> IResult::Output, E> @@ -1438,6 +1617,10 @@ where /// /// *Streaming version*: Will return `Err(nom::Err::Incomplete(_))` if there is not enough data. /// +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::recognize_float_parts` with input wrapped in `nom::input::Streaming`" +)] pub fn recognize_float_parts>( input: T, ) -> IResult< @@ -1562,6 +1745,10 @@ where /// assert_eq!(parser("123K-01"), Ok(("K-01", 123.0))); /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Float)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::float` with input wrapped in `nom::input::Streaming`" +)] pub fn float>(input: T) -> IResult where T: Slice> + Slice>, @@ -1620,6 +1807,10 @@ where /// assert_eq!(parser("123K-01"), Ok(("K-01", 123.0))); /// assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Float)))); /// ``` +#[deprecated( + since = "8.0.0", + note = "Replaced with `nom::number::double` with input wrapped in `nom::input::Streaming`" +)] pub fn double>(input: T) -> IResult where T: Slice> + Slice>, diff --git a/src/number/tests.rs b/src/number/tests.rs index 16caa98e..8c1799e8 100644 --- a/src/number/tests.rs +++ b/src/number/tests.rs @@ -454,6 +454,7 @@ mod complete { #[cfg(feature = "std")] fn parse_f64(i: &str) -> IResult<&str, f64, ()> { + #[allow(deprecated)] // will just become `pub(crate)` later match crate::number::complete::recognize_float_or_exceptions(i) { Err(e) => Err(e), Ok((i, s)) => { @@ -1248,6 +1249,7 @@ mod streaming { #[cfg(feature = "std")] fn parse_f64(i: Streaming<&str>) -> IResult, f64, ()> { + #[allow(deprecated)] // will just become `pub(crate)` later match crate::number::streaming::recognize_float_or_exceptions(i) { Err(e) => Err(e), Ok((i, s)) => {