pub struct SubcommandRouter { /* private fields */ }Expand description
Strategy helper implementing chain-of-responsibility style subcommand dispatch.
The router handles the first token of args as the subcommand name and forwards
trailing arguments recursively to the selected child strategy.
Implementations§
Trait Implementations§
Source§impl CommandStrategy for SubcommandRouter
impl CommandStrategy for SubcommandRouter
Source§fn execute(
&self,
_options: Vec<Switch>,
_arguments: Vec<Argument>,
params: Vec<String>,
) -> Result<(), StrategyError>
fn execute( &self, _options: Vec<Switch>, _arguments: Vec<Argument>, params: Vec<String>, ) -> Result<(), StrategyError>
Executes the strategy with parsed invocation data.
Strategy implementations should validate argument viability internally.
Source§fn subcommand_catalog(&self) -> Option<&dyn SubcommandCatalog>
fn subcommand_catalog(&self) -> Option<&dyn SubcommandCatalog>
Optional catalog exposure used by help renderers to discover nested command trees.
Source§impl Default for SubcommandRouter
impl Default for SubcommandRouter
Source§fn default() -> SubcommandRouter
fn default() -> SubcommandRouter
Returns the “default value” for a type. Read more
Source§impl SubcommandCatalog for SubcommandRouter
impl SubcommandCatalog for SubcommandRouter
Source§fn subcommands(&self) -> Vec<Command>
fn subcommands(&self) -> Vec<Command>
Returns direct subcommands owned by this strategy.
Auto Trait Implementations§
impl Freeze for SubcommandRouter
impl !RefUnwindSafe for SubcommandRouter
impl Send for SubcommandRouter
impl Sync for SubcommandRouter
impl Unpin for SubcommandRouter
impl UnsafeUnpin for SubcommandRouter
impl !UnwindSafe for SubcommandRouter
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