pub trait ChoiceParameter: Sized {
// Required methods
fn list() -> Vec<CommandParameterChoice>;
fn from_index(index: usize) -> Option<Self>;
fn from_name(name: &str) -> Option<Self>;
fn name(&self) -> &'static str;
fn localized_name(&self, locale: &str) -> Option<&'static str>;
}Expand description
This trait is implemented by crate::macros::ChoiceParameter. See its docs for more
information
Required Methods§
Sourcefn list() -> Vec<CommandParameterChoice>
fn list() -> Vec<CommandParameterChoice>
Returns all possible choices for this parameter, in the order they will appear in Discord.
Sourcefn from_index(index: usize) -> Option<Self>
fn from_index(index: usize) -> Option<Self>
Returns an instance of Self corresponding to the given index into Self::list()
Sourcefn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Parses the name as returned by Self::name() into an instance of Self
Sourcefn localized_name(&self, locale: &str) -> Option<&'static str>
fn localized_name(&self, locale: &str) -> Option<&'static str>
Returns the localized name for the given locale, if one is set
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.