Enum lexical_core::ErrorCode[][src]

#[repr(i32)]
pub enum ErrorCode {
Show 15 variants Overflow, Underflow, InvalidDigit, Empty, EmptyMantissa, EmptyExponent, EmptyInteger, EmptyFraction, InvalidPositiveMantissaSign, MissingMantissaSign, InvalidExponent, InvalidPositiveExponentSign, MissingExponentSign, ExponentWithoutFraction, InvalidLeadingZeros, // some variants omitted
}
Expand description

Error code, indicating failure type.

Error messages are designating by an error code of less than 0. This is to be compatible with C conventions. This enumeration is FFI-compatible for interfacing with C code.

FFI

For interfacing with FFI-code, this may be approximated by:

const int32_t OVERFLOW = -1;
const int32_t UNDERFLOW = -2;
const int32_t INVALID_DIGIT = -3;
const int32_t EMPTY = -4;
const int32_t EMPTY_FRACTION = -5;
const int32_t EMPTY_EXPONENT = -6;

Safety

Assigning any value outside the range [-6, -1] to value of type ErrorCode may invoke undefined-behavior.

Variants

Overflow

Integral overflow occurred during numeric parsing.

Numeric overflow takes precedence over the presence of an invalid digit.

Underflow

Integral underflow occurred during numeric parsing.

Numeric overflow takes precedence over the presence of an invalid digit.

InvalidDigit

Invalid digit found before string termination.

Empty

Empty byte array found.

EmptyMantissa

Empty mantissa found.

EmptyExponent

Empty exponent found.

EmptyInteger

Empty integer found.

EmptyFraction

Empty fraction found.

InvalidPositiveMantissaSign

Invalid positive mantissa sign was found.

MissingMantissaSign

Mantissa sign was required, but not found.

InvalidExponent

Exponent was present but not allowed.

InvalidPositiveExponentSign

Invalid positive exponent sign was found.

MissingExponentSign

Exponent sign was required, but not found.

ExponentWithoutFraction

Exponent was present without fraction component.

InvalidLeadingZeros

Integer had invalid leading zeros.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.