pub struct CommandRegistry { /* private fields */ }Expand description
Registry for extension-provided commands.
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
Sourcepub fn register_command(&mut self, def: CommandDefinition) -> Result<()>
pub fn register_command(&mut self, def: CommandDefinition) -> Result<()>
Registers a command.
Returns an error if a command with the same name is already registered.
Sourcepub fn unregister_command(&mut self, name: &str) -> Result<()>
pub fn unregister_command(&mut self, name: &str) -> Result<()>
Unregisters a command by name.
Returns an error if the command is not found.
Sourcepub fn get_command(&self, name: &str) -> Option<&CommandDefinition>
pub fn get_command(&self, name: &str) -> Option<&CommandDefinition>
Gets a command definition by name.
Sourcepub fn list_commands(&self) -> Vec<&CommandDefinition>
pub fn list_commands(&self) -> Vec<&CommandDefinition>
Lists all registered commands.
Trait Implementations§
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