#[non_exhaustive]pub enum ParseError {
Empty,
Syntax(usize, String),
Overflow,
TimeUnit(usize, String),
NegativeExponentOverflow,
PositiveExponentOverflow,
NegativeNumber,
InvalidInput(String),
}
Expand description
Error type emitted during the parsing
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Empty
Returned, if the input was empty.
Syntax(usize, String)
A syntax error. Syntax errors report the position (column) where it was encountered and a reason.
Overflow
Currently only used internally for overflows of the maximum Duration.
TODO: Rename to positive overflow
TODO: Add NegativeOverflow
TimeUnit(usize, String)
An error concerning time units. Like ParseError::Syntax
the position where the error
occurred is included.
NegativeExponentOverflow
The exponent exceeded the minimum negative exponent (-32768
)
PositiveExponentOverflow
The exponent exceeded the maximum positive exponent (+32767
)
NegativeNumber
The input number was negative. Note that numbers close to 0
(< 1e-18
) are not negative
but resolve to 0
InvalidInput(String)
A generic error if no other error type fits
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl<'de> Deserialize<'de> for ParseError
impl<'de> Deserialize<'de> for ParseError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParseError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParseError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<TryFromDurationError> for ParseError
impl From<TryFromDurationError> for ParseError
Source§fn from(error: TryFromDurationError) -> ParseError
fn from(error: TryFromDurationError) -> ParseError
Converts to this type from the input type.
Source§impl Hash for ParseError
impl Hash for ParseError
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
Source§impl Serialize for ParseError
impl Serialize for ParseError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more