From 56c24db7bcd92e2eb9a779bd141fcc73a7c433c0 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Tue, 14 Apr 2026 02:59:38 +0800 Subject: Add `strip_all_flags` method and `operate_args` method --- mingling/src/parser/picker.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mingling/src/parser/picker.rs') 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 Picker { 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 Argument>(mut self, operation: F) -> Self { + self.args = operation(self.args); + self + } } impl, G> From for Picker { @@ -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 Argument>(mut self, operation: F) -> Self { + self.args = operation(self.args); + self + } } }; } -- cgit