pub struct CommandMapActionCommand<'a> { /* private fields */ }
Expand description
An ActionCommand
that only composes a CommandMap
’s
subcommands. Any customization of the clap::Command
or the
behavior of CommandMapActionCommand::action
will require a
custom type.
// create a new CommandMapActionCommand, including all of the
// subcommands it must dispatch to.
let foo = CommandMapActionCommand::new(
"foo",
CommandMap::builder()
.push(HelloWorldCommand {})
.build(),
);
// add that CommandMapActionCommand to its parent CommandMap, which
// will automatically dispatch and route to subcommands
let command_map = CommandMap::builder()
.push(foo)
.build();
Implementations§
Source§impl<'a> CommandMapActionCommand<'a>
impl<'a> CommandMapActionCommand<'a>
Sourcepub fn new(
name: &'static str,
command_map: CommandMap<'a>,
) -> CommandMapActionCommand<'a>
pub fn new( name: &'static str, command_map: CommandMap<'a>, ) -> CommandMapActionCommand<'a>
Create a new CommandMapActionCommand
give a name and a
CommandMap
.
Trait Implementations§
Source§impl<'a> ActionCommand for CommandMapActionCommand<'a>
impl<'a> ActionCommand for CommandMapActionCommand<'a>
Source§fn command(&self, command: Command) -> Command
fn command(&self, command: Command) -> Command
The
Command
that describes how to match this on the command
line using Clap. command
is already constructed using
Self::name
for convenience.Source§fn action(&self, matches: Vec1<&ArgMatches>) -> Result<(), Box<dyn Error>>
fn action(&self, matches: Vec1<&ArgMatches>) -> Result<(), Box<dyn Error>>
The action to take when this command is matched on the command
line.
CommandMap
s may be nested, and this is represented
by the matches being returned as a list of at least one element.Auto Trait Implementations§
impl<'a> Freeze for CommandMapActionCommand<'a>
impl<'a> !RefUnwindSafe for CommandMapActionCommand<'a>
impl<'a> Send for CommandMapActionCommand<'a>
impl<'a> Sync for CommandMapActionCommand<'a>
impl<'a> Unpin for CommandMapActionCommand<'a>
impl<'a> !UnwindSafe for CommandMapActionCommand<'a>
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