pub struct CommandRegistry { /* private fields */ }Expand description
A registry of named commands.
Commands are registered at startup and looked up by name during play. The registry is immutable after construction.
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
Sourcepub fn register(&mut self, command: impl Command + 'static)
pub fn register(&mut self, command: impl Command + 'static)
Registers a command. Overwrites any existing command with the same name.
Sourcepub fn execute(&self, name: &str, args: &CommandArgs, ctx: &dyn Context) -> bool
pub fn execute(&self, name: &str, args: &CommandArgs, ctx: &dyn Context) -> bool
Executes a command by name with parsed arguments.
Returns true if the command was found and executed.
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 UnsafeUnpin 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