Skip to main content

ArgParserTracker

Struct ArgParserTracker 

Source
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

Container for ArgumentParser tracking in CodeGenContext

§Complexity

N/A (data structure)

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: bool

Whether we’ve generated the Args struct for current function

Implementations§

Source§

impl ArgParserTracker

Source

pub fn new() -> Self

Create new tracker

§Complexity

1 (struct initialization)

Source

pub fn register_parser(&mut self, var_name: String, info: ArgParserInfo)

Register a new ArgumentParser assignment

§Complexity

2 (struct creation + hashmap insert)

Source

pub fn get_parser_mut(&mut self, var_name: &str) -> Option<&mut ArgParserInfo>

Get mutable reference to parser info by variable name

§Complexity

1 (hashmap lookup)

Source

pub fn get_parser(&self, var_name: &str) -> Option<&ArgParserInfo>

Get reference to parser info by variable name

§Complexity

1 (hashmap lookup)

Source

pub fn clear(&mut self)

Clear all parser tracking (e.g., when entering new function)

§Complexity

2 (hashmap clears)

Source

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)

Source

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)

Source

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)

Source

pub fn get_subparsers(&self, subparsers_var: &str) -> Option<&SubparserInfo>

DEPYLER-0399: Get subparser collection info

§Complexity

1 (hashmap lookup)

Source

pub fn get_subparsers_mut( &mut self, subparsers_var: &str, ) -> Option<&mut SubparserInfo>

DEPYLER-0399: Get mutable subparser collection info

§Complexity

1 (hashmap lookup)

Source

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)

Source

pub fn get_subcommand(&self, subcommand_var: &str) -> Option<&SubcommandInfo>

DEPYLER-0399: Get subcommand info

§Complexity

1 (hashmap lookup)

Source

pub fn get_subcommand_mut( &mut self, subcommand_var: &str, ) -> Option<&mut SubcommandInfo>

DEPYLER-0399: Get mutable subcommand info

§Complexity

1 (hashmap lookup)

Source

pub fn has_parsers(&self) -> bool

Check if any ArgumentParser was detected

§Complexity

1 (hashmap empty check)

Source

pub fn get_first_parser(&self) -> Option<&ArgParserInfo>

Get the first parser (assumes single parser per function for now)

§Complexity

2 (iterator + first)

Source

pub fn has_subcommands(&self) -> bool

DEPYLER-0399: Check if any subcommands are defined

§Complexity

1 (hashmap empty check)

Trait Implementations§

Source§

impl Clone for ArgParserTracker

Source§

fn clone(&self) -> ArgParserTracker

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ArgParserTracker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ArgParserTracker

Source§

fn default() -> ArgParserTracker

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more