pub struct CommandRegistry { /* private fields */ }Expand description
Registry for managing slash commands
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
Sourcepub fn register(&mut self, command: SlashCommand) -> Result<(), CommandError>
pub fn register(&mut self, command: SlashCommand) -> Result<(), CommandError>
Sourcepub fn get(&self, name: &str) -> Option<&SlashCommand>
pub fn get(&self, name: &str) -> Option<&SlashCommand>
Get a command by name
Sourcepub fn list_names(&self) -> Vec<String>
pub fn list_names(&self) -> Vec<String>
Get all registered command names
Sourcepub fn list_all(&self) -> Vec<&SlashCommand>
pub fn list_all(&self) -> Vec<&SlashCommand>
Get all commands
Sourcepub fn unregister(&mut self, name: &str) -> Result<(), CommandError>
pub fn unregister(&mut self, name: &str) -> Result<(), CommandError>
Unregister a command
§Returns
Ok(())if command was removedErr(CommandError::NotFound)if command doesn’t exist
Trait Implementations§
Source§impl Debug for CommandRegistry
impl Debug for CommandRegistry
Source§impl Default for CommandRegistry
impl Default for CommandRegistry
Source§fn default() -> CommandRegistry
fn default() -> CommandRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CommandRegistry
impl !RefUnwindSafe for CommandRegistry
impl Send for CommandRegistry
impl Sync for CommandRegistry
impl Unpin for CommandRegistry
impl !UnwindSafe for CommandRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more