Skip to main content

TokenEnumError

Enum TokenEnumError 

Source
#[non_exhaustive]
pub enum TokenEnumError {
Show 14 variants MalformedSource { spelling: String, }, UnknownClass { class: String, }, UnknownProperty { class: String, property: String, }, NoAllowedTokens { class: String, property: String, }, NoFallback { class: String, property: String, }, UnknownFallback { token: String, }, UnnameableToken { token: String, }, VariantCollision { first: String, second: String, variant: String, }, InvalidName, ReservedName, UnknownLibrary { library: String, }, InvalidVariant { token: String, variant: String, }, UnknownVariantToken { token: String, }, Duplicate,
}
Expand description

What a configured TokenEnum asked for that could not be honoured.

Every one of these is a configuration mistake rather than a schema one, and each stops generation: an enum silently left out, or one quietly given a variant name nobody chose, is worse than a build that stops and says which.

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

MalformedSource

A source not spelled Class.property.

Fields

§spelling: String

What was configured.

§

UnknownClass

A class the library does not declare.

Fields

§class: String

The class named.

§

UnknownProperty

A property the class does not declare.

Fields

§class: String

The class that was found.

§property: String

The property that was not.

§

NoAllowedTokens

A source property declaring no allowedTokens, so there are no variants to generate.

Fields

§class: String

The class holding the property.

§property: String

The property named.

§

NoFallback

A default asked for from a property with no token fallback to take it from.

Fields

§class: String

The class holding the property.

§property: String

The property named.

§

UnknownFallback

A default asked for from a fallback the allowed tokens do not admit.

Fields

§token: String

The fallback the property declares.

§

UnnameableToken

A token no casing rule turns into a Rust name — an empty spelling, one opening with a digit, one that is punctuation alone.

Fields

§token: String

The token that could not be named.

§

VariantCollision

Two tokens reaching one variant name. Suffixing one of them would put a name nobody chose into a public API, so the caller is asked instead.

Fields

§first: String

The token that took the name.

§second: String

The token that wanted it too.

§variant: String

The name they both reached.

§

InvalidName

A type name the caller spelled that Rust would not take.

§

ReservedName

A type name the generated file already uses for something else.

§

UnknownLibrary

A library neither generated by this run nor declared with extern_library, which is a name nothing will ever match.

Fields

§library: String

The library named.

§

InvalidVariant

A variant name the caller spelled that Rust would not take.

Fields

§token: String

The token it was given for.

§variant: String

The name that was given.

§

UnknownVariantToken

A variant override for a token the source property does not admit, which is a name that would silently do nothing.

Fields

§token: String

The token the override named.

§

Duplicate

Two enums of one library under one name.

Trait Implementations§

Source§

impl Debug for TokenEnumError

Source§

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

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

impl Display for TokenEnumError

Source§

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

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

impl Error for TokenEnumError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

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> 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.