pub struct CommandRegistry { /* private fields */ }Expand description
Holds all registered commands and dispatches them.
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
pub fn new() -> Self
pub fn register( &mut self, name: impl Into<String>, help: impl Into<String>, usage: impl Into<String>, handler: impl Fn(&[&str], &mut ConsoleState) -> CommandOutput + Send + Sync + 'static, )
pub fn register_alias( &mut self, alias: impl Into<String>, canonical: impl Into<String>, )
pub fn dispatch(&self, input: &str, state: &mut ConsoleState) -> CommandOutput
pub fn names(&self) -> Vec<&str>
pub fn get(&self, name: &str) -> Option<&CommandRegistration>
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