Trait SubCommand

Source
pub trait SubCommand: SubCommandGroup {
    // Provided methods
    fn create_option(
        name: impl Into<String>,
        description: impl Into<String>,
    ) -> CreateCommandOption { ... }
    fn from_value(value: &CommandDataOptionValue) -> Result<Self> { ... }
}
Expand description

A sub-command which can be nested inside of a Command or SubCommandGroup.

This is a sub-trait of SubCommandGroup, as a SubCommand can be used anywhere a SubCommandGroup can.

Provided Methods§

Source

fn create_option( name: impl Into<String>, description: impl Into<String>, ) -> CreateCommandOption

Create the command option.

Source

fn from_value(value: &CommandDataOptionValue) -> Result<Self>

Extract data from a CommandDataOption.

§Errors

Returns an error if the implementation fails.

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.

Implementors§