diff --git a/src/stream/mod.rs b/src/stream/mod.rs index 5b0614f5..08879829 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -111,7 +111,7 @@ pub type Located = LocatingSlice; /// byte offsets to line numbers. /// /// See [`Parser::span`][crate::Parser::span] and [`Parser::with_span`][crate::Parser::with_span] for more details -#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)] #[doc(alias = "LocatingSliceSpan")] #[doc(alias = "Located")] pub struct LocatingSlice { @@ -182,19 +182,12 @@ impl crate::lib::std::fmt::Display for Locatin } } -impl crate::lib::std::fmt::Debug for LocatingSlice { - #[inline] - fn fmt(&self, f: &mut crate::lib::std::fmt::Formatter<'_>) -> crate::lib::std::fmt::Result { - self.input.fmt(f) - } -} - /// Allow recovering from parse errors, capturing them as the parser continues /// /// Generally, this will be used indirectly via /// [`RecoverableParser::recoverable_parse`][crate::RecoverableParser::recoverable_parse]. #[cfg(feature = "unstable-recover")] -#[derive(Clone)] +#[derive(Clone, Debug)] #[cfg(feature = "std")] pub struct Recoverable where @@ -287,25 +280,6 @@ where } } -#[cfg(feature = "unstable-recover")] -#[cfg(feature = "std")] -impl - crate::lib::std::fmt::Debug for Recoverable -{ - #[inline] - fn fmt(&self, f: &mut crate::lib::std::fmt::Formatter<'_>) -> crate::lib::std::fmt::Result { - if f.alternate() { - self.input.fmt(f) - } else { - f.debug_struct("Recoverable") - .field("input", &self.input) - .field("errors", &self.errors) - .field("is_recoverable", &self.is_recoverable) - .finish() - } - } -} - /// Thread global state through your parsers /// /// Use cases @@ -344,7 +318,7 @@ impl /// let output = word.parse(input).unwrap(); /// assert_eq!(state, 1); /// ``` -#[derive(Clone, Copy, Default, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] #[doc(alias = "LocatingSliceSpan")] pub struct Stateful { /// Inner input being wrapped in state @@ -375,22 +349,6 @@ impl crate::lib::std::fmt::Display for Stat } } -impl crate::lib::std::fmt::Debug - for Stateful -{ - #[inline] - fn fmt(&self, f: &mut crate::lib::std::fmt::Formatter<'_>) -> crate::lib::std::fmt::Result { - if f.alternate() { - self.input.fmt(f) - } else { - f.debug_struct("Stateful") - .field("input", &self.input) - .field("state", &self.state) - .finish() - } - } -} - /// Mark the input as a partial buffer for streaming input. /// /// Complete input means that we already have all of the data. This will be the common case with @@ -455,7 +413,7 @@ impl crate::lib: /// // while the complete version knows that all of the data is there /// assert_eq!(alpha0_complete.parse_peek("abcd"), Ok(("", "abcd"))); /// ``` -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Partial { input: I, partial: bool, @@ -508,20 +466,6 @@ impl crate::lib::std::fmt::Display for Partial } } -impl crate::lib::std::fmt::Debug for Partial { - #[inline] - fn fmt(&self, f: &mut crate::lib::std::fmt::Formatter<'_>) -> crate::lib::std::fmt::Result { - if f.alternate() { - self.input.fmt(f) - } else { - f.debug_struct("Partial") - .field("input", &self.input) - .field("partial", &self.partial) - .finish() - } - } -} - /// Abstract method to calculate the input length pub trait SliceLen { /// Calculates the input length, as indicated by its name,