pub struct ArgParserTracker {
pub parsers: HashMap<String, ArgParserInfo>,
pub group_to_parser: HashMap<String, String>,
pub subparsers: HashMap<String, SubparserInfo>,
pub subcommands: HashMap<String, SubcommandInfo>,
pub subcommand_var_to_cmd: HashMap<String, String>,
pub struct_generated: bool,
}Expand description
Fields§
§parsers: HashMap<String, ArgParserInfo>Currently active ArgumentParser instances (keyed by variable name)
group_to_parser: HashMap<String, String>DEPYLER-0396: Map argument group variables to their parent parser e.g., “input_group” → “parser” This allows tracking add_argument() calls on groups
subparsers: HashMap<String, SubparserInfo>DEPYLER-0399: Subparser collections (variable → info) Maps subparsers variable name to parent parser info
subcommands: HashMap<String, SubcommandInfo>DEPYLER-0399: Subcommands (parser variable → info) Maps subcommand parser variable (e.g., “parser_clone”) to subcommand details
subcommand_var_to_cmd: HashMap<String, String>DEPYLER-0822: Maps subcommand parser variable to command name e.g., “top_parser” → “top” (for looking up SubcommandInfo when processing add_argument)
struct_generated: boolWhether we’ve generated the Args struct for current function
Implementations§
Source§impl ArgParserTracker
impl ArgParserTracker
Sourcepub fn register_parser(&mut self, var_name: String, info: ArgParserInfo)
pub fn register_parser(&mut self, var_name: String, info: ArgParserInfo)
Sourcepub fn get_parser_mut(&mut self, var_name: &str) -> Option<&mut ArgParserInfo>
pub fn get_parser_mut(&mut self, var_name: &str) -> Option<&mut ArgParserInfo>
Sourcepub fn get_parser(&self, var_name: &str) -> Option<&ArgParserInfo>
pub fn get_parser(&self, var_name: &str) -> Option<&ArgParserInfo>
Sourcepub fn register_group(&mut self, group_var: String, parser_var: String)
pub fn register_group(&mut self, group_var: String, parser_var: String)
DEPYLER-0396: Register an argument group variable Maps group variable name to its parent parser
§Complexity
1 (hashmap insert)
Sourcepub fn get_parser_for_group(&self, group_var: &str) -> Option<String>
pub fn get_parser_for_group(&self, group_var: &str) -> Option<String>
DEPYLER-0396: Get parser variable name for a group variable Returns the parent parser if this variable is an argument group Recursively resolves nested groups (e.g., format_group → output_group → parser)
§Complexity
O(depth) where depth is the nesting level of groups (typically 1-3)
Sourcepub fn register_subparsers(
&mut self,
subparsers_var: String,
info: SubparserInfo,
)
pub fn register_subparsers( &mut self, subparsers_var: String, info: SubparserInfo, )
DEPYLER-0399: Register a subparser collection Pattern: subparsers = parser.add_subparsers(dest=“command”, required=True)
§Complexity
1 (hashmap insert)
Sourcepub fn get_subparsers(&self, subparsers_var: &str) -> Option<&SubparserInfo>
pub fn get_subparsers(&self, subparsers_var: &str) -> Option<&SubparserInfo>
Sourcepub fn get_subparsers_mut(
&mut self,
subparsers_var: &str,
) -> Option<&mut SubparserInfo>
pub fn get_subparsers_mut( &mut self, subparsers_var: &str, ) -> Option<&mut SubparserInfo>
Sourcepub fn register_subcommand(
&mut self,
subcommand_var: String,
info: SubcommandInfo,
)
pub fn register_subcommand( &mut self, subcommand_var: String, info: SubcommandInfo, )
DEPYLER-0399: Register a subcommand Pattern: parser_clone = subparsers.add_parser(“clone”, help=“…”)
§Complexity
1 (hashmap insert)
Sourcepub fn get_subcommand(&self, subcommand_var: &str) -> Option<&SubcommandInfo>
pub fn get_subcommand(&self, subcommand_var: &str) -> Option<&SubcommandInfo>
Sourcepub fn get_subcommand_mut(
&mut self,
subcommand_var: &str,
) -> Option<&mut SubcommandInfo>
pub fn get_subcommand_mut( &mut self, subcommand_var: &str, ) -> Option<&mut SubcommandInfo>
Sourcepub fn has_parsers(&self) -> bool
pub fn has_parsers(&self) -> bool
Sourcepub fn get_first_parser(&self) -> Option<&ArgParserInfo>
pub fn get_first_parser(&self) -> Option<&ArgParserInfo>
Sourcepub fn has_subcommands(&self) -> bool
pub fn has_subcommands(&self) -> bool
Trait Implementations§
Source§impl Clone for ArgParserTracker
impl Clone for ArgParserTracker
Source§fn clone(&self) -> ArgParserTracker
fn clone(&self) -> ArgParserTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArgParserTracker
impl Debug for ArgParserTracker
Source§impl Default for ArgParserTracker
impl Default for ArgParserTracker
Source§fn default() -> ArgParserTracker
fn default() -> ArgParserTracker
Auto Trait Implementations§
impl Freeze for ArgParserTracker
impl RefUnwindSafe for ArgParserTracker
impl Send for ArgParserTracker
impl Sync for ArgParserTracker
impl Unpin for ArgParserTracker
impl UnsafeUnpin for ArgParserTracker
impl UnwindSafe for ArgParserTracker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more