From a6697111573952903b3d9d0659ffe1af23432c3c Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 20 Jul 2026 07:36:03 +0800 Subject: feat: add pick_or, pick_or_default, and pick_or_route shorthands Remove the `Default` bound from `pick()` and `EntryPicker::pick()`, allowing non-Default types to be used as arguments. Add `IntoPicker::pick_or`, `pick_or_default`, and `pick_or_route` convenience methods for common fallback patterns. Fix token splitting in `arg!` macro to correctly handle angle brackets. --- mingling/src/picker/entry_picker.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mingling/src') diff --git a/mingling/src/picker/entry_picker.rs b/mingling/src/picker/entry_picker.rs index 7364c50..d9fb37c 100644 --- a/mingling/src/picker/entry_picker.rs +++ b/mingling/src/picker/entry_picker.rs @@ -35,7 +35,7 @@ pub trait EntryPicker<'a, This> { ) -> PickerPattern1<'a, Next, ChainProcess> where Self: Sized, - Next: Pickable<'a> + Default + Sized, + Next: Pickable<'a> + Sized, { let picker = Self::to_picker(self); Picker::build_pattern1(picker.into_args(), arg.into(), None) @@ -60,7 +60,7 @@ pub trait EntryPicker<'a, This> { ) -> PickerPattern1<'a, Next, ChainProcess> where Self: Sized, - Next: Pickable<'a> + Default + Sized, + Next: Pickable<'a> + Sized, F: FnMut() -> Next + 'static, { self.pick(arg).or(func) @@ -107,7 +107,7 @@ pub trait EntryPicker<'a, This> { ) -> PickerPattern1<'a, Next, ChainProcess> where Self: Sized, - Next: Pickable<'a> + Default + Sized, + Next: Pickable<'a> + Sized, F: FnMut() -> ChainProcess + 'static, { self.pick(arg).or_route(func) -- cgit