Skip to main content

Module rule_argument_rewrite

Module rule_argument_rewrite 

Source
Expand description

The shared result and builder of transforms that add tokens to a command line. What: The shared result and builder of fixed transforms that add tokens to a command line. Why: A transform either leaves the caller’s arguments alone or returns a new owned list; saying which lets the caller keep the original vector without comparing contents.

In TS you’d write (pseudocode):

// type ArgumentRewrite = { kind: 'unchanged' } | { kind: 'rewritten'; args: string[] };

Enums§

ArgumentRewrite
What: The outcome of one transform. An enum is a closed set of named alternatives; Rewritten carries the new owned argument list, Vec<OsString>. Why: The TypeScript rules returned the same array object to mean “unchanged”; Rust says it with a variant instead of object identity.

Functions§

insert_tokens
What: Copy arguments with inserted placed before index at. &[&str] borrows a list of text spellings; usize is the list index type. Why: Injected tokens are ASCII flags, while every existing argument keeps its bytes.