diff options
Diffstat (limited to 'mingling_picker/src/picker/patterns.rs')
| -rw-r--r-- | mingling_picker/src/picker/patterns.rs | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/mingling_picker/src/picker/patterns.rs b/mingling_picker/src/picker/patterns.rs index bd0eb12..2242a70 100644 --- a/mingling_picker/src/picker/patterns.rs +++ b/mingling_picker/src/picker/patterns.rs @@ -1,17 +1,46 @@ +use mingling_picker_macros::internal_repeat; + use crate::{Pickable, Picker, PickerArgs, PickerFlag, PickerResult}; -mingling_picker_macros::internal_repeat!(1..=32 => { - pub struct PickerPattern$<'a, (T$,)+> - where (T$: Pickable + Default,)+ +internal_repeat!(1..=32 => { + pub struct PickerPattern$<'a, (T$,+)> + where (T$: Pickable + Default,+) { pub args: PickerArgs<'a>, ( pub flag_$: &'a PickerFlag<'a, T$>, pub result_$: PickerResult<T$>, - )+ + +) } }); +internal_repeat!(1..32 => { + impl<'a, (T$,+)> PickerPattern$<'a, (T$,+)> + where (T$: Pickable + Default,+) + { + #[allow(clippy::type_complexity)] + pub fn pick<N>(self, flag: &'a PickerFlag<'a, N>) -> PickerPattern$+<'a, (T$,+), N> + where + N: Pickable + Default, + { + PickerPattern$+ { + // Args + args: self.args, + + // Current + flag_$+: flag, + result_$+: PickerResult::Unparsed, + + // Prev + ( + flag_$: self.flag_$, + result_$: self.result_$, + +) + } + } + } +}); + impl<'a> Picker<'a> { pub fn pick<N>(self, flag: &'a PickerFlag<'a, N>) -> PickerPattern1<'a, N> where |
