twilight_validate::component

Enum ComponentValidationErrorType

Source
#[non_exhaustive]
pub enum ComponentValidationErrorType {
Show 24 variants ActionRowComponentCount { count: usize, }, ButtonConflict, ButtonStyle { style: ButtonStyle, }, ComponentCount { count: usize, }, ComponentCustomIdLength { chars: usize, }, ComponentLabelLength { chars: usize, }, InvalidChildComponent { kind: ComponentType, }, InvalidRootComponent { kind: ComponentType, }, SelectMaximumValuesCount { count: usize, }, SelectMinimumValuesCount { count: usize, }, SelectNotEnoughDefaultValues { provided: usize, min: usize, }, SelectOptionsMissing, SelectOptionCount { count: usize, }, SelectOptionDescriptionLength { chars: usize, }, SelectOptionLabelLength { chars: usize, }, SelectOptionValueLength { chars: usize, }, SelectPlaceholderLength { chars: usize, }, SelectTooManyDefaultValues { provided: usize, max: usize, }, SelectUnsupportedDefaultValues { kind: SelectMenuType, }, TextInputLabelLength { len: usize, }, TextInputMaxLength { len: usize, }, TextInputMinLength { len: usize, }, TextInputPlaceholderLength { chars: usize, }, TextInputValueLength { chars: usize, },
}
Expand description

Type of ComponentValidationError that occurred.

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

ActionRowComponentCount

Number of components a provided [ActionRow] is larger than the maximum.

Fields

§count: usize

Number of components within the action row.

§

ButtonConflict

Button has both a custom ID and URL set.

§

ButtonStyle

Button does not have the required field based on its style.

A button with a style of [ButtonStyle::Link] must have a URL set, while buttons of other styles must have a custom ID set.

Fields

§style: ButtonStyle

Style of the button.

§

ComponentCount

Number of components provided is larger than the maximum.

Fields

§count: usize

Number of components that were provided.

§

ComponentCustomIdLength

Component custom ID is larger than the the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

ComponentLabelLength

Component label is larger than the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

InvalidChildComponent

Provided component cannot be a child component.

Fields

§kind: ComponentType

Type of provided component.

§

InvalidRootComponent

Provided component cannot be a root component.

Fields

§kind: ComponentType

Type of provided component.

§

SelectMaximumValuesCount

Maximum number of items that can be chosen is smaller than the minimum or larger than the maximum.

Fields

§count: usize

Number of options that were provided.

§

SelectMinimumValuesCount

Minimum number of items that must be chosen is larger than the maximum.

Fields

§count: usize

Number of options that were provided.

§

SelectNotEnoughDefaultValues

The select menu specifies less default values than its own minimum values requirement.

Fields

§provided: usize

Number of default values provided.

§min: usize

Select menu’s minimum number of default values.

§

SelectOptionsMissing

The options field is None for a text select menu.

§

SelectOptionCount

Number of select menu options provided is larger than the maximum.

Fields

§count: usize

Number of options that were provided.

§

SelectOptionDescriptionLength

Description of a select menu option is larger than the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

SelectOptionLabelLength

Label of a select menu option is larger than the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

SelectOptionValueLength

Value of a select menu option is larger than the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

SelectPlaceholderLength

Placeholder of a component is larger than the maximum.

Fields

§chars: usize

Number of codepoints that were provided.

§

SelectTooManyDefaultValues

The select menu specifies less default values than its own minimum values requirement.

Fields

§provided: usize

Number of default values provided.

§max: usize

Select menu’s maximum number of values.

§

SelectUnsupportedDefaultValues

The select menu type doesn’t support the default_values field.

Fields

§kind: SelectMenuType

The select menu’s type.

§

TextInputLabelLength

[TextInput::label] is invalid.

Fields

§len: usize

Provided length.

§

TextInputMaxLength

[TextInput::max_length] is invalid.

Fields

§len: usize

Provided length.

§

TextInputMinLength

[TextInput::min_length] is too long.

Fields

§len: usize

Provided length.

§

TextInputPlaceholderLength

Placeholder of a [TextInput] component is larger than TEXT_INPUT_PLACEHOLDER_MAX.

Fields

§chars: usize

Provided number of codepoints.

§

TextInputValueLength

Value of a [TextInput] component is larger than TEXT_INPUT_LENGTH_MAX.

Fields

§chars: usize

Provided number of codepoints.

Trait Implementations§

Source§

impl Debug for ComponentValidationErrorType

Source§

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

Formats the value using the given formatter. 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, 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.