pub trait Args: FromArgMatches + Sized {
// Required methods
fn augment_args(cmd: Command) -> Command;
fn augment_args_for_update(cmd: Command) -> Command;
// Provided method
fn group_id() -> Option<Id> { ... }
}
Expand description
Parse a set of arguments into a user-defined container.
Implementing this trait lets a parent container delegate argument parsing behavior to Self
.
with:
#[command(flatten)] args: ChildArgs
: Attribute can only be used with struct fields that implArgs
.Variant(ChildArgs)
: No attribute is used with enum variants that implArgs
.
NOTE: Deriving requires the derive
feature flag
Required Methods§
sourcefn augment_args(cmd: Command) -> Command
fn augment_args(cmd: Command) -> Command
Append to Command
so it can instantiate Self
via
FromArgMatches::from_arg_matches_mut
This is used to implement #[command(flatten)]
See also CommandFactory::command
.
sourcefn augment_args_for_update(cmd: Command) -> Command
fn augment_args_for_update(cmd: Command) -> Command
Append to Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
This is used to implement #[command(flatten)]
See also CommandFactory::command_for_update
.
Provided Methods§
sourcefn group_id() -> Option<Id>
fn group_id() -> Option<Id>
Report the ArgGroup::id
for this set of arguments
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.