litrs::err

Enum ParseErrorKind

source
#[non_exhaustive]
pub(crate) enum ParseErrorKind {
Show 37 variants Empty, UnexpectedChar, InvalidLiteral, DoesNotStartWithDigit, InvalidDigit, NoDigits, NoExponentDigits, UnknownEscape, UnterminatedEscape, InvalidXEscape, NonAsciiXEscape, UnicodeEscapeInByteLiteral, InvalidStartOfUnicodeEscape, UnicodeEscapeWithoutBrace, NonHexDigitInUnicodeEscape, TooManyDigitInUnicodeEscape, InvalidUnicodeEscapeChar, UnterminatedUnicodeEscape, UnterminatedCharLiteral, OverlongCharLiteral, EmptyCharLiteral, UnterminatedByteLiteral, OverlongByteLiteral, EmptyByteLiteral, NonAsciiInByteLiteral, UnescapedSingleQuote, UnescapedSpecialWhitespace, DoesNotStartWithQuote, UnterminatedRawString, UnterminatedString, InvalidStringLiteralStart, InvalidByteLiteralStart, InvalidByteStringLiteralStart, IsolatedCr, InvalidSuffix, UnexpectedIntegerLit, IntegerSuffixStartingWithE,
}
Expand description

Kinds of errors.

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

The input was an empty string

§

UnexpectedChar

An unexpected char was encountered.

§

InvalidLiteral

Literal was not recognized.

§

DoesNotStartWithDigit

Input does not start with decimal digit when trying to parse an integer.

§

InvalidDigit

A digit invalid for the specified integer base was found.

§

NoDigits

Integer literal does not contain any valid digits.

§

NoExponentDigits

Exponent of a float literal does not contain any digits.

§

UnknownEscape

An unknown escape code, e.g. \b.

§

UnterminatedEscape

A started escape sequence where the input ended before the escape was finished.

§

InvalidXEscape

An \x escape where the two digits are not valid hex digits.

§

NonAsciiXEscape

A string or character literal using the \xNN escape where NN > 0x7F.

§

UnicodeEscapeInByteLiteral

A \u{...} escape in a byte or byte string literal.

§

InvalidStartOfUnicodeEscape

A Unicode escape that does not start with a hex digit.

§

UnicodeEscapeWithoutBrace

A \u{...} escape that lacks the opening brace.

§

NonHexDigitInUnicodeEscape

In a \u{...} escape, a non-hex digit and non-underscore character was found.

§

TooManyDigitInUnicodeEscape

More than 6 digits found in unicode escape.

§

InvalidUnicodeEscapeChar

The value from a unicode escape does not represent a valid character.

§

UnterminatedUnicodeEscape

A \u{.. escape that is not terminated (lacks the closing brace).

§

UnterminatedCharLiteral

A character literal that’s not terminated.

§

OverlongCharLiteral

A character literal that contains more than one character.

§

EmptyCharLiteral

An empty character literal, i.e. ''.

§

UnterminatedByteLiteral

§

OverlongByteLiteral

§

EmptyByteLiteral

§

NonAsciiInByteLiteral

§

UnescapedSingleQuote

A ' character was not escaped in a character or byte literal, or a " character was not escaped in a string or byte string literal.

§

UnescapedSpecialWhitespace

A \n, \t or \r raw character in a char or byte literal.

§

DoesNotStartWithQuote

When parsing a character, byte, string or byte string literal directly and the input does not start with the corresponding quote character (plus optional raw string prefix).

§

UnterminatedRawString

Unterminated raw string literal.

§

UnterminatedString

String literal without a " at the end.

§

InvalidStringLiteralStart

Invalid start for a string literal.

§

InvalidByteLiteralStart

Invalid start for a byte literal.

§

InvalidByteStringLiteralStart

§

IsolatedCr

An literal \r character not followed by a \n character in a (raw) string or byte string literal.

§

InvalidSuffix

Literal suffix is not a valid identifier.

§

UnexpectedIntegerLit

Returned by Float::parse if an integer literal (no fractional nor exponent part) is passed.

§

IntegerSuffixStartingWithE

Integer suffixes cannot start with e or E as this conflicts with the grammar for float literals.

Trait Implementations§

source§

impl Clone for ParseErrorKind

source§

fn clone(&self) -> ParseErrorKind

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 ParseErrorKind

source§

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

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

impl PartialEq for ParseErrorKind

source§

fn eq(&self, other: &ParseErrorKind) -> 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 Copy for ParseErrorKind

source§

impl Eq for ParseErrorKind

source§

impl StructuralPartialEq for ParseErrorKind

Auto Trait Implementations§

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