pub trait DynamicSubCommand: Sized {
// Required methods
fn commands() -> &'static [&'static CommandInfo] ⓘ;
fn try_redact_arg_values(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Vec<String>, EarlyExit>>;
fn try_from_args(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Self, EarlyExit>>;
}Expand description
Trait implemented by values returned from a dynamic subcommand handler.
Required Methods§
Sourcefn commands() -> &'static [&'static CommandInfo] ⓘ
fn commands() -> &'static [&'static CommandInfo] ⓘ
Info about supported subcommands.
Sourcefn try_redact_arg_values(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Vec<String>, EarlyExit>>
fn try_redact_arg_values( command_name: &[&str], args: &[&str], ) -> Option<Result<Vec<String>, EarlyExit>>
Perform the function of FromArgs::redact_arg_values for this dynamic
command.
The full list of subcommands, ending with the subcommand that should be
dynamically recognized, is passed in command_name. If the command
passed is not recognized, this function should return None. Otherwise
it should return Some, and the value within the Some has the same
semantics as the return of FromArgs::redact_arg_values.
Sourcefn try_from_args(
command_name: &[&str],
args: &[&str],
) -> Option<Result<Self, EarlyExit>>
fn try_from_args( command_name: &[&str], args: &[&str], ) -> Option<Result<Self, EarlyExit>>
Perform the function of FromArgs::from_args for this dynamic command.
The full list of subcommands, ending with the subcommand that should be
dynamically recognized, is passed in command_name. If the command
passed is not recognized, this function should return None. Otherwise
it should return Some, and the value within the Some has the same
semantics as the return of FromArgs::from_args.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.