lexical_util::error

Enum Error

Source
#[non_exhaustive]
pub enum Error {
Show 49 variants Overflow(usize), Underflow(usize), InvalidDigit(usize), Empty(usize), EmptyMantissa(usize), EmptyExponent(usize), EmptyInteger(usize), EmptyFraction(usize), InvalidPositiveMantissaSign(usize), MissingMantissaSign(usize), InvalidExponent(usize), InvalidPositiveExponentSign(usize), MissingExponentSign(usize), ExponentWithoutFraction(usize), InvalidLeadingZeros(usize), MissingExponent(usize), MissingSign(usize), InvalidPositiveSign(usize), InvalidNegativeSign(usize), InvalidMantissaRadix, InvalidExponentBase, InvalidExponentRadix, InvalidDigitSeparator, InvalidDecimalPoint, InvalidExponentSymbol, InvalidBasePrefix, InvalidBaseSuffix, InvalidPunctuation, InvalidExponentFlags, InvalidMantissaSign, InvalidExponentSign, InvalidSpecial, InvalidConsecutiveIntegerDigitSeparator, InvalidConsecutiveFractionDigitSeparator, InvalidConsecutiveExponentDigitSeparator, InvalidFlags, InvalidNanString, NanStringTooLong, InvalidInfString, InfStringTooLong, InvalidInfinityString, InfinityStringTooLong, InfinityStringTooShort, InvalidFloatParseAlgorithm, InvalidRadix, InvalidFloatPrecision, InvalidNegativeExponentBreak, InvalidPositiveExponentBreak, Success,
}
Expand description

Error code during parsing, indicating failure type.

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.
§

Overflow(usize)

Integral overflow occurred during numeric parsing.

§

Underflow(usize)

Integral underflow occurred during numeric parsing.

§

InvalidDigit(usize)

Invalid digit found before string termination.

§

Empty(usize)

Empty byte array found.

§

EmptyMantissa(usize)

Empty mantissa found.

§

EmptyExponent(usize)

Empty exponent found.

§

EmptyInteger(usize)

Empty integer found.

§

EmptyFraction(usize)

Empty fraction found.

§

InvalidPositiveMantissaSign(usize)

Invalid positive mantissa sign was found.

§

MissingMantissaSign(usize)

Mantissa sign was required(usize), but not found.

§

InvalidExponent(usize)

Exponent was present but not allowed.

§

InvalidPositiveExponentSign(usize)

Invalid positive exponent sign was found.

§

MissingExponentSign(usize)

Exponent sign was required(usize), but not found.

§

ExponentWithoutFraction(usize)

Exponent was present without fraction component.

§

InvalidLeadingZeros(usize)

Integer or integer component of float had invalid leading zeros.

§

MissingExponent(usize)

No exponent with required exponent notation.

§

MissingSign(usize)

Integral sign was required(usize), but not found.

§

InvalidPositiveSign(usize)

Invalid positive sign for an integer was found.

§

InvalidNegativeSign(usize)

Invalid negative sign for an unsigned type was found.

§

InvalidMantissaRadix

Invalid radix for the mantissa (significant) digits.

§

InvalidExponentBase

Invalid base for the exponent.

§

InvalidExponentRadix

Invalid radix for the exponent digits.

§

InvalidDigitSeparator

Invalid digit separator character.

§

InvalidDecimalPoint

Invalid decimal point character.

§

InvalidExponentSymbol

Invalid symbol to represent exponent notation.

§

InvalidBasePrefix

Invalid character for a base prefix.

§

InvalidBaseSuffix

Invalid character for a base suffix.

§

InvalidPunctuation

Invalid punctuation characters: multiple symbols overlap.

§

InvalidExponentFlags

Optional exponent flags were set while disabling exponent notation.

§

InvalidMantissaSign

Set no positive mantissa sign while requiring mantissa signs.

§

InvalidExponentSign

Set no positive exponent sign while requiring exponent signs.

§

InvalidSpecial

Set optional special float flags while disable special floats.

§

InvalidConsecutiveIntegerDigitSeparator

Invalid consecutive integer digit separator.

§

InvalidConsecutiveFractionDigitSeparator

Invalid consecutive fraction digit separator.

§

InvalidConsecutiveExponentDigitSeparator

Invalid consecutive exponent digit separator.

§

InvalidFlags

Invalid flags were set without the format feature.

§

InvalidNanString

Invalid NaN string: must start with an n character.

§

NanStringTooLong

NaN string is too long.

§

InvalidInfString

Invalid short infinity string: must start with an i character.

§

InfStringTooLong

Short infinity string is too long.

§

InvalidInfinityString

Invalid long infinity string: must start with an i character.

§

InfinityStringTooLong

Long infinity string is too long.

§

InfinityStringTooShort

Long infinity string is too short: it must be as long as short infinity.

§

InvalidFloatParseAlgorithm

Invalid float parsing algorithm.

§

InvalidRadix

Invalid radix for the significant digits.

§

InvalidFloatPrecision

Invalid precision flags for writing floats.

§

InvalidNegativeExponentBreak

Invalid negative exponent break: break is above 0.

§

InvalidPositiveExponentBreak

Invalid positive exponent break: break is below 0.

§

Success

An error did not actually occur, and the result was successful.

Implementations§

Source§

impl Error

Source

pub fn index(&self) -> Option<&usize>

Get the index for the parsing error.

Source

pub const fn is_overflow(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_underflow(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_digit(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_empty(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_empty_mantissa(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_empty_exponent(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_empty_integer(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_empty_fraction(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_positive_mantissa_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_missing_mantissa_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_positive_exponent_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_missing_exponent_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_exponent_without_fraction(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_leading_zeros(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_missing_exponent(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_missing_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_positive_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_negative_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_mantissa_radix(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent_base(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent_radix(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_digit_separator(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_decimal_point(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent_symbol(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_base_prefix(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_base_suffix(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_punctuation(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent_flags(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_mantissa_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_exponent_sign(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_special(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_consecutive_integer_digit_separator(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_consecutive_fraction_digit_separator(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_consecutive_exponent_digit_separator(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_flags(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_nan_string(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_nan_string_too_long(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_inf_string(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_inf_string_too_long(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_infinity_string(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_infinity_string_too_long(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_infinity_string_too_short(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_float_parse_algorithm(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_radix(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_float_precision(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_negative_exponent_break(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_invalid_positive_exponent_break(&self) -> bool

const fn check to see if an error is of a specific type.

Source

pub const fn is_success(&self) -> bool

const fn check to see if an error is of a specific type.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Ord for Error

Source§

fn cmp(&self, other: &Error) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Error

Source§

fn partial_cmp(&self, other: &Error) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Error

Source§

impl Eq for Error

Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.