diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-14 21:57:06 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-14 21:57:06 +0800 |
| commit | 59d9fbdf0873b241774366a91c76728d63a9004d (patch) | |
| tree | ad93f4f34b4ff9afb7fb3edfc2de5ed6c826bb70 /mingling/src/parser/picker.rs | |
| parent | 8ed25a022daaf0c9d50b3cb224cb67598e383e65 (diff) | |
| parent | 33469c75614c444f512fd51dbc78a31a9a4bec82 (diff) | |
Add argument filtering and CLI build support
Diffstat (limited to 'mingling/src/parser/picker.rs')
| -rw-r--r-- | mingling/src/parser/picker.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mingling/src/parser/picker.rs b/mingling/src/parser/picker.rs index 9258002..d69e27a 100644 --- a/mingling/src/parser/picker.rs +++ b/mingling/src/parser/picker.rs @@ -108,6 +108,16 @@ impl<R> Picker<R> { None => None, } } + + /// Applies an operation to the parsed arguments and returns the modified `Picker`. + /// + /// Takes a closure that receives the current `Argument` and returns a new `Argument`. + /// The returned `Argument` replaces the original arguments in the builder. + /// This method can be used to modify or transform the parsed arguments before extracting values. + pub fn operate_args<F: FnOnce(Argument) -> Argument>(mut self, operation: F) -> Self { + self.args = operation(self.args); + self + } } impl<T: Into<Argument>, G> From<T> for Picker<G> { @@ -189,6 +199,16 @@ macro_rules! define_pick_structs { self.$final_val = edit(self.$final_val); self } + + /// Applies an operation to the parsed arguments and returns the modified `Picker`. + /// + /// Takes a closure that receives the current `Argument` and returns a new `Argument`. + /// The returned `Argument` replaces the original arguments in the builder. + /// This method can be used to modify or transform the parsed arguments before extracting values. + pub fn operate_args<F: FnOnce(Argument) -> Argument>(mut self, operation: F) -> Self { + self.args = operation(self.args); + self + } } }; } |
