Trait serenity_commands::CommandOption
source · pub trait CommandOption: Sized {
const TYPE: CommandOptionType;
// Required methods
fn to_option(
name: impl Into<String>,
description: impl Into<String>
) -> CreateCommandOption;
fn from_option(option: Option<&CommandDataOptionValue>) -> Result<Self>;
}
Expand description
A sub-command or sub-command group which can be nested within other
CommandOption
s or Command
s.
Required Associated Constants§
sourceconst TYPE: CommandOptionType
const TYPE: CommandOptionType
The type of this command option.
Required Methods§
sourcefn to_option(
name: impl Into<String>,
description: impl Into<String>
) -> CreateCommandOption
fn to_option( name: impl Into<String>, description: impl Into<String> ) -> CreateCommandOption
Create the command option.
sourcefn from_option(option: Option<&CommandDataOptionValue>) -> Result<Self>
fn from_option(option: Option<&CommandDataOptionValue>) -> Result<Self>
Extract this command option’s data from an option list.
Errors
Returns an error if the implementation fails.
Object Safety§
This trait is not object safe.