Skip to main content

SnbtErrorKind

Enum SnbtErrorKind 

Source
#[non_exhaustive]
pub enum SnbtErrorKind {
Show 33 variants TrailingData, ExpectedSymbol(char), ExpectedValue, ExpectedKey, EmptyKey, ExpectedArrayElement, InvalidArrayElementType, ExpectedNumberOrBoolean, ExpectedStringUuid, UnknownOperation { name: String, argument_count: usize, }, ExpectedNumber, ExpectedBinaryNumeral, ExpectedDecimalNumeral, ExpectedHexNumeral, ExpectedQuotedString, UnclosedQuotedString, UnclosedEscapeSequence, InvalidEscape(char), ExpectedHexEscape { digits: usize, }, InvalidCodepoint(u32), ExpectedCharacterName, UnclosedCharacterName, InvalidCharacterName(String), ExpectedUnquotedString, InvalidFloatingPoint, NonFiniteNumber, InvalidUnderscore, InvalidInteger, LeadingZero, ExpectedNonNegativeNumber, IntegerTooLarge, NumberOutOfRange { number_type: SnbtNumberType, unsigned: bool, }, InvalidNumber,
}
Expand description

Specific reason why SNBT parsing failed.

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

TrailingData

Non-whitespace input remained after a complete tag.

§

ExpectedSymbol(char)

A grammar symbol was required at the cursor.

§

ExpectedValue

An SNBT value was required at the cursor.

§

ExpectedKey

A compound key was required at the cursor.

§

EmptyKey

A compound key was present but empty.

§

ExpectedArrayElement

A typed-array element was not an integer.

§

InvalidArrayElementType

A typed-array element used an unsupported integer width.

§

ExpectedNumberOrBoolean

The bool operation received neither a number nor a boolean.

§

ExpectedStringUuid

The uuid operation did not receive a valid UUID string.

§

UnknownOperation

No built-in operation matched the name and argument count.

Fields

§name: String

Operation name supplied by the input.

§argument_count: usize

Number of supplied arguments.

§

ExpectedNumber

A number was required at the cursor.

§

ExpectedBinaryNumeral

A binary numeral was required at the cursor.

§

ExpectedDecimalNumeral

A decimal numeral was required at the cursor.

§

ExpectedHexNumeral

A hexadecimal numeral was required at the cursor.

§

ExpectedQuotedString

A quoted string was required at the cursor.

§

UnclosedQuotedString

A quoted string was not terminated.

§

UnclosedEscapeSequence

An escape introducer was not followed by an escape value.

§

InvalidEscape(char)

A quoted string contained an unsupported escape.

§

ExpectedHexEscape

A Unicode escape did not contain the required hexadecimal digits.

Fields

§digits: usize

Required number of hexadecimal digits.

§

InvalidCodepoint(u32)

A Unicode escape resolved to an invalid code point.

§

ExpectedCharacterName

A named Unicode escape did not begin with a character name.

§

UnclosedCharacterName

A named Unicode escape was not terminated.

§

InvalidCharacterName(String)

A named Unicode escape did not identify a character.

§

ExpectedUnquotedString

An unquoted string was required at the cursor.

§

InvalidFloatingPoint

A floating-point token could not be parsed.

§

NonFiniteNumber

A non-finite floating-point value was supplied.

§

InvalidUnderscore

A number placed underscores outside its digits.

§

InvalidInteger

An integer token could not be parsed.

§

LeadingZero

A decimal integer contained a leading zero.

§

ExpectedNonNegativeNumber

An unsigned integer was negative.

§

IntegerTooLarge

An integer exceeded the parser’s intermediate representation.

§

NumberOutOfRange

A number did not fit its requested NBT integer type.

Fields

§number_type: SnbtNumberType

Requested NBT integer type.

§unsigned: bool

Whether the literal requested the unsigned range.

§

InvalidNumber

A number token did not contain any digits.

Implementations§

Source§

impl SnbtErrorKind

Source

pub fn component(&self) -> TextComponent

Returns this failure as a translatable text component.

Trait Implementations§

Source§

impl Clone for SnbtErrorKind

Source§

fn clone(&self) -> SnbtErrorKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SnbtErrorKind

Source§

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

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

impl Display for SnbtErrorKind

Source§

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

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

impl Eq for SnbtErrorKind

Source§

impl PartialEq for SnbtErrorKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SnbtErrorKind

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
§

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

§

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

Checks if this value is equivalent to the given key. Read more
§

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

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Shared<Self>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more