pub struct CommandMachine<C: Command> { /* private fields */ }
Expand description
Track mapped commands and handle their execution.
Implementations§
Source§impl<C: Command> CommandMachine<C>
impl<C: Command> CommandMachine<C>
Sourcepub fn add_command(&mut self, cmd: C)
pub fn add_command(&mut self, cmd: C)
Map a command under its names.
Sourcepub fn complete_name(&self, prefix: &str) -> Vec<String>
pub fn complete_name(&self, prefix: &str) -> Vec<String>
Generate a list of completion candidates for command names.
Sourcepub fn complete_aliases(&self, prefix: &str) -> Vec<String>
pub fn complete_aliases(&self, prefix: &str) -> Vec<String>
Generate a list of completion candidates for command aliases.
Sourcepub fn get_last_command(&self) -> String
pub fn get_last_command(&self) -> String
Get the previously executed command.
Trait Implementations§
Source§impl<C, I> Commandable<C, I> for CommandMachine<C>
impl<C, I> Commandable<C, I> for CommandMachine<C>
Source§fn command(
&mut self,
action: &CommandAction,
ctx: &C::Context,
rstore: &mut RegisterStore,
) -> UIResult<Vec<(Action<I>, C::Context)>, I>
fn command( &mut self, action: &CommandAction, ctx: &C::Context, rstore: &mut RegisterStore, ) -> UIResult<Vec<(Action<I>, C::Context)>, I>
Execute a command action.
Auto Trait Implementations§
impl<C> Freeze for CommandMachine<C>
impl<C> RefUnwindSafe for CommandMachine<C>where
C: RefUnwindSafe,
impl<C> Send for CommandMachine<C>where
C: Send,
impl<C> Sync for CommandMachine<C>where
C: Sync,
impl<C> Unpin for CommandMachine<C>
impl<C> UnwindSafe for CommandMachine<C>where
C: UnwindSafe,
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