Enum ErrorCode

Source
pub enum ErrorCode {
Show 32 variants UnexpectedEndOfInput, Syntax, Comma, Colon, Digit, HexDigit, UnicodeEscape, SurrogatePair(InvalidUtf16Tuple), TrailingSurrogate, UnescapedControlCodePoint, InvalidEscape, InvalidUtf8String, InvalidNumber, TrailingCharacters, OutOfBoundsI8, OutOfBoundsI16, OutOfBoundsI32, OutOfBoundsI64, OutOfBoundsU8, OutOfBoundsU16, OutOfBoundsU32, OutOfBoundsU64, NotAChar, Base64(DecodeError), ExpectedBool, ExpectedNumber, ExpectedString, ExpectedNull, ExpectedArray, ExpectedObject, ExpectedEnum, Message(String),
}
Expand description

Everything that can go wrong during deserialization.

Variants§

§

UnexpectedEndOfInput

Expected more data but the input ended.

§

Syntax

A generic syntax error. Any valid json would have been ok, but alas…

§

Comma

Expected a comma (,) to separate collection elements.

§

Colon

Expected a colon (:) to separate a key from a value.

§

Digit

Expected a decimal digit. Didn’t get one. Sad times.

§

HexDigit

Expected hexadecimal digit as part of a unicode escape sequence in a string.

§

UnicodeEscape

Expected a unicode escape (because we just parsed a unicode escape of a leading surrogate codepoint).

§

SurrogatePair(InvalidUtf16Tuple)

Could not merge two unicode escapes into a single code point.

§

TrailingSurrogate

A unicode escape encoded a trailing surrogate codepoint without a preceding leading surrogate codepoint.

§

UnescapedControlCodePoint

A string contained an unescaped control code point.

§

InvalidEscape

A string contained a backslash followed by a non-escape character.

§

InvalidUtf8String

A string literal contains a non-utf8 byte sequence.

§

InvalidNumber

A number is valid json but it evaluates to -0 or an infinity

§

TrailingCharacters

The input contained valid json followed by at least one non-whitespace byte.

§

OutOfBoundsI8

Attempted to parse a number as an i8 that was out of bounds.

§

OutOfBoundsI16

Attempted to parse a number as an i16 that was out of bounds.

§

OutOfBoundsI32

Attempted to parse a number as an i32 that was out of bounds.

§

OutOfBoundsI64

Attempted to parse a number as an i64 that was less than -2^53 or greater than 2^53.

§

OutOfBoundsU8

Attempted to parse a number as an u8 that was out of bounds.

§

OutOfBoundsU16

Attempted to parse a number as an u16 that was out of bounds.

§

OutOfBoundsU32

Attempted to parse a number as an u32 that was out of bounds.

§

OutOfBoundsU64

Attempted to parse a number as an u64 that was greater than 2^53.

§

NotAChar

Chars are represented as strings that contain one unicode scalar value.

§

Base64(DecodeError)

Attempted to read a string as base64-encoded bytes, but the string was not valid base64.

§

ExpectedBool

Expected a boolean, found something else.

§

ExpectedNumber

Expected a number, found something else.

§

ExpectedString

Expected a string, found something else.

§

ExpectedNull

Expected null, found something else.

§

ExpectedArray

Expected an array, found something else.

§

ExpectedObject

Expected an object, found something else.

§

ExpectedEnum

Expected an enum, found something else.

§

Message(String)

Custom, stringly-typed error.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

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 ErrorCode

Source§

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

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

impl PartialEq for ErrorCode

Source§

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

Source§

impl StructuralPartialEq for ErrorCode

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, dest: *mut u8)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.