Enum lexical_core::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<(), Error>

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

impl Display for Error

source§

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

Formats the value using the given formatter. 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 + PartialOrd,

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§

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

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

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

source§

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

🔬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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.