aboutsummaryrefslogtreecommitdiff
path: root/mingling
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-20 07:36:03 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-20 07:36:03 +0800
commita6697111573952903b3d9d0659ffe1af23432c3c (patch)
tree9490fd96d1581e3d2954e2ca4894014ad5d29f00 /mingling
parentcdc1864344003321ffae7fe597465d02fd3a5865 (diff)
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.
Diffstat (limited to 'mingling')
-rw-r--r--mingling/src/picker/entry_picker.rs6
1 files changed, 3 insertions, 3 deletions
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<This>>
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<This>>
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<This>>
where
Self: Sized,
- Next: Pickable<'a> + Default + Sized,
+ Next: Pickable<'a> + Sized,
F: FnMut() -> ChainProcess<This> + 'static,
{
self.pick(arg).or_route(func)