aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/parser
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-20 14:06:45 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-20 14:06:45 +0800
commit491ae5956242eccfa4cafd3cc34d66f10c26cd22 (patch)
tree65e801625ae3ec85056b8a684b7971f993681db8 /mingling/src/parser
parent6f66a3158f4a4b2bca42ec385abefbf4011618cc (diff)
Make `pick_or` accept `Into<TNext>` for default value
Diffstat (limited to 'mingling/src/parser')
-rw-r--r--mingling/src/parser/picker.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/mingling/src/parser/picker.rs b/mingling/src/parser/picker.rs
index 73c3b8d..449351a 100644
--- a/mingling/src/parser/picker.rs
+++ b/mingling/src/parser/picker.rs
@@ -50,11 +50,11 @@ impl<R> Picker<R> {
///
/// The extracted type `TNext` must implement `Pickable`.
/// If the flag is not present, the provided `or` value is used.
- pub fn pick_or<TNext>(mut self, val: impl Into<Flag>, or: TNext) -> Pick1<TNext, R>
+ pub fn pick_or<TNext>(mut self, val: impl Into<Flag>, or: impl Into<TNext>) -> Pick1<TNext, R>
where
TNext: Pickable<Output = TNext>,
{
- let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or);
+ let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into());
Pick1 {
args: self.args,
val_1: v,
@@ -265,11 +265,11 @@ macro_rules! impl_pick_structs {
///
/// The extracted type `TNext` must implement `Pickable`.
/// If the flag is not present, the provided `or` value is used.
- pub fn pick_or<TNext>(mut self, val: impl Into<mingling_core::Flag>, or: TNext) -> $next<$($T,)+ TNext, R>
+ pub fn pick_or<TNext>(mut self, val: impl Into<mingling_core::Flag>, or: impl Into<TNext>) -> $next<$($T,)+ TNext, R>
where
TNext: Pickable<Output = TNext>,
{
- let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or);
+ let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into());
$next {
args: self.args,
$($val: self.$val,)+