pub struct Command<Context, E> { /* private fields */ }
Expand description
Struct to define a command in the REPL
Implementations§
Source§impl<Context, E> Command<Context, E>
impl<Context, E> Command<Context, E>
Sourcepub fn new(
name: impl ToString,
callback: impl Fn(BTreeMap<String, String>, &mut Context) -> Result<Option<String>, E> + 'static,
) -> Self
pub fn new( name: impl ToString, callback: impl Fn(BTreeMap<String, String>, &mut Context) -> Result<Option<String>, E> + 'static, ) -> Self
Create a new command with the given name and callback function
Sourcepub fn with_parameter(self, parameter: Parameter) -> Result<Command<Context, E>>
pub fn with_parameter(self, parameter: Parameter) -> Result<Command<Context, E>>
Add a parameter to the command. The order of the parameters is the same as the order in which this is called for each parameter.
Sourcepub fn with_help(self, help: impl ToString) -> Command<Context, E>
pub fn with_help(self, help: impl ToString) -> Command<Context, E>
Add a help summary for the command
Sourcepub fn with_alias(self, help: impl ToString) -> Command<Context, E>
pub fn with_alias(self, help: impl ToString) -> Command<Context, E>
Add an alias for the command
Trait Implementations§
Auto Trait Implementations§
impl<Context, E> Freeze for Command<Context, E>
impl<Context, E> !RefUnwindSafe for Command<Context, E>
impl<Context, E> !Send for Command<Context, E>
impl<Context, E> !Sync for Command<Context, E>
impl<Context, E> Unpin for Command<Context, E>
impl<Context, E> !UnwindSafe for Command<Context, E>
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