#[non_exhaustive]pub enum JsonNumberTokenError {
Fractional,
OutOfSafeIntegerRange,
}Expand description
Explains why a validated JSON number cannot be represented as a safe integer.
JsonNumberToken::exact_safe_integer returns this error when the exact
decimal value is fractional or outside the IEEE-754 safe-integer range.
§Examples
use qubit_json::decode::JsonNumberTokenError;
let error = JsonNumberTokenError::Fractional;
assert_eq!(error.to_string(), "number is fractional");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.
Fractional
The token has a non-integral mathematical value.
OutOfSafeIntegerRange
The integer is outside the inclusive safe-integer range.
Trait Implementations§
Source§impl Clone for JsonNumberTokenError
impl Clone for JsonNumberTokenError
impl Copy for JsonNumberTokenError
Source§impl Debug for JsonNumberTokenError
impl Debug for JsonNumberTokenError
Source§impl Display for JsonNumberTokenError
impl Display for JsonNumberTokenError
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Formats the error as a concise description of the failed conversion.
Fractional values and integers outside the safe range have distinct messages so callers can preserve the failure category in diagnostics.
§Parameters
formatter: Receives the formatted error text.
§Returns
Returns Ok(()) when the message is written.
§Errors
Returns the formatter’s error if writing the message fails.
impl Eq for JsonNumberTokenError
Source§impl Error for JsonNumberTokenError
impl Error for JsonNumberTokenError
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 Hash for JsonNumberTokenError
impl Hash for JsonNumberTokenError
Source§impl PartialEq for JsonNumberTokenError
impl PartialEq for JsonNumberTokenError
impl StructuralPartialEq for JsonNumberTokenError
Auto Trait Implementations§
impl Forget for JsonNumberTokenError
impl Freeze for JsonNumberTokenError
impl RefUnwindSafe for JsonNumberTokenError
impl Send for JsonNumberTokenError
impl Sync for JsonNumberTokenError
impl Unpin for JsonNumberTokenError
impl UnsafeUnpin for JsonNumberTokenError
impl UnwindSafe for JsonNumberTokenError
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