1use std::{fmt::{self, Debug}, marker::PhantomData};
2
3use crate::{expr::IndexedCaptures, haystack::{HaystackItem, HaystackOf}, matcher::Matcher};
4
5#[derive(#[automatically_derived]
impl<I: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<I>, B: ::core::default::Default + Matcher<I>>
::core::default::Default for Or<I, A, B> {
#[inline]
fn default() -> Or<I, A, B> {
Or(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}Default)]
6pub struct Or<I: HaystackItem, A: Matcher<I>, B: Matcher<I>>(
7 pub PhantomData<I>,
8 pub PhantomData<A>,
9 pub PhantomData<B>,
10);
11
12impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Matcher<I> for Or<I, A, B> {
13 fn matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool {
14 let start = hay.index();
15
16 if A::matches(hay) {
17 true
18 } else {
19 hay.rollback(start);
20 B::matches(hay)
21 }
22 }
23
24 fn all_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> Vec<usize> {
26 let state_fork = hay.index();
27 let mut vec = B::all_matches(hay);
30 hay.rollback(state_fork);
31 vec.append(&mut A::all_matches(hay));
32
33 vec
34 }
35
36 fn captures<'a, H: HaystackOf<'a, I>>(hay: &mut H, caps: &mut IndexedCaptures) -> bool {
37 let (initial_state, initial_caps) = (hay.index(), caps.clone());
38 if A::captures(hay, caps) {
39 true
40 } else {
41 hay.rollback(initial_state);
42 *caps = initial_caps;
43 B::captures(hay, caps)
44 }
45 }
46
47 fn all_captures<'a, H: HaystackOf<'a, I>>(
48 hay: &mut H,
49 caps: &mut IndexedCaptures
50 ) -> Vec<(usize, IndexedCaptures)> {
51 let (state_fork, mut caps_fork) = (hay.index(), caps.clone());
52 let mut vec = B::all_captures(hay, caps);
54 hay.rollback(state_fork);
55 vec.append(&mut A::all_captures(hay, &mut caps_fork));
56 vec
57 }
58}
59
60impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Debug for Or<I, A, B> {
61 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
62 f.write_fmt(format_args!("{0:?}|{1:?}", A::default(), B::default()))write!(f, "{:?}|{:?}", A::default(), B::default())
63 }
64}
65
66#[derive(#[automatically_derived]
impl<I: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<I>, B: ::core::default::Default + Matcher<I>>
::core::default::Default for Then<I, A, B> {
#[inline]
fn default() -> Then<I, A, B> {
Then(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}Default)]
67pub struct Then<I: HaystackItem, A: Matcher<I>, B: Matcher<I>>(
68 pub PhantomData<I>,
69 pub PhantomData<A>,
70 pub PhantomData<B>,
71);
72
73impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Matcher<I> for Then<I, A, B> {
74 fn matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool {
75 if let Some(state_fork) = Self::all_matches(hay).pop() {
76 hay.rollback(state_fork);
77 true
78 } else {
79 false
80 }
81 }
82
83 fn all_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> Vec<usize> {
84 A::all_matches(hay).into_iter().flat_map(|state_fork| {
85 hay.rollback(state_fork);
86 B::all_matches(hay)
87 }).collect()
88 }
89
90 fn captures<'a, H: HaystackOf<'a, I>>(hay: &mut H, caps: &mut IndexedCaptures) -> bool {
91 if let Some((state_fork, caps_fork)) = Self::all_captures(hay, caps).pop() {
92 hay.rollback(state_fork);
93 *caps = caps_fork;
94 true
95 } else {
96 false
97 }
98 }
99
100 fn all_captures<'a, H: HaystackOf<'a, I>>(
101 hay: &mut H,
102 caps: &mut IndexedCaptures
103 ) -> Vec<(usize, IndexedCaptures)> {
104 A::all_captures(hay, caps).into_iter().flat_map(|(state_fork, mut caps_fork)| {
105 hay.rollback(state_fork);
106 B::all_captures(hay, &mut caps_fork)
107 }).collect()
108 }
109}
110
111impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Debug for Then<I, A, B> {
112 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
113 f.write_fmt(format_args!("{0:?}{1:?}", A::default(), B::default()))write!(f, "{:?}{:?}", A::default(), B::default())
114 }
115}
116
117macro_rules! define_paired_n {
127 ($pair:ident, $name:ident, $combiner:ident, $([$a:ident $b:ident])+) => {
128 #[derive(Default)]
129 pub struct $name<
130 Z: HaystackItem,
131 $($a: Matcher<Z>, $b: Matcher<Z>),+
132 >(
133 pub PhantomData<Z>,
134 $(pub PhantomData<$a>, pub PhantomData<$b>),+
135 );
136
137 impl<
138 Z: HaystackItem,
139 $($a: Matcher<Z>, $b: Matcher<Z>),+
140 > Matcher<Z> for $name<Z, $($a, $b),+> {
141 fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
142 $combiner::<Z, $($pair<Z, $a, $b>),+>::matches(hay)
143 }
144
145 fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
146 $combiner::<Z, $($pair<Z, $a, $b>),+>::all_matches(hay)
147 }
148
149 fn captures<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures) -> bool {
150 $combiner::<Z, $($pair<Z, $a, $b>),+>::captures(hay, caps)
151 }
152
153 fn all_captures<'a, Y: HaystackOf<'a, Z>>(
154 hay: &mut Y,
155 caps: &mut IndexedCaptures
156 ) -> Vec<(usize, IndexedCaptures)> {
157 $combiner::<Z, $($pair<Z, $a, $b>),+>::all_captures(hay, caps)
158 }
159 }
160
161 impl<Z: HaystackItem, $($a: Matcher<Z>, $b: Matcher<Z>),+> Debug for $name<Z, $($a, $b),+> {
162 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
163 write!(f, "{:?}", $combiner::<Z, $($pair<Z, $a, $b>),+>::default())
164 }
165 }
166 };
167}
168
169pub struct Or4<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>> ::core::default::Default for Or4<Z, A, B, C, D> {
#[inline]
fn default() -> Or4<Z, A, B, C, D> {
Or4(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>> Matcher<Z> for Or4<Z, A, B, C, D> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Or::<Z, Or<Z, A, B>, Or<Z, C, D>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Or::<Z, Or<Z, A, B>, Or<Z, C, D>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Or::<Z, Or<Z, A, B>, Or<Z, C, D>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Or::<Z, Or<Z, A, B>, Or<Z, C, D>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>> Debug for Or4<Z, A, B, C, D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Or::<Z, Or<Z, A, B>, Or<Z, C, D>>::default()))
}
}define_paired_n!(Or, Or4, Or, [A B] [C D]);
170pub struct Or8<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>,
H: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>, pub PhantomData<E>,
pub PhantomData<F>, pub PhantomData<G>, pub PhantomData<H>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>, E: ::core::default::Default + Matcher<Z>,
F: ::core::default::Default + Matcher<Z>, G: ::core::default::Default +
Matcher<Z>, H: ::core::default::Default + Matcher<Z>>
::core::default::Default for Or8<Z, A, B, C, D, E, F, G, H> {
#[inline]
fn default() -> Or8<Z, A, B, C, D, E, F, G, H> {
Or8(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>>
Matcher<Z> for Or8<Z, A, B, C, D, E, F, G, H> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Or4::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>,
Or<Z, G, H>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Or4::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>,
Or<Z, G, H>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Or4::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>,
Or<Z, G, H>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Or4::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>,
Or<Z, G, H>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>>
Debug for Or8<Z, A, B, C, D, E, F, G, H> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Or4::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>,
Or<Z, G, H>>::default()))
}
}define_paired_n!(Or, Or8, Or4, [A B] [C D] [E F] [G H]);
171pub struct Or16<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>,
I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>, M: Matcher<Z>,
N: Matcher<Z>, O: Matcher<Z>,
P: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>, pub PhantomData<E>,
pub PhantomData<F>, pub PhantomData<G>, pub PhantomData<H>,
pub PhantomData<I>, pub PhantomData<J>, pub PhantomData<K>,
pub PhantomData<L>, pub PhantomData<M>, pub PhantomData<N>,
pub PhantomData<O>, pub PhantomData<P>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>, E: ::core::default::Default + Matcher<Z>,
F: ::core::default::Default + Matcher<Z>, G: ::core::default::Default +
Matcher<Z>, H: ::core::default::Default + Matcher<Z>,
I: ::core::default::Default + Matcher<Z>, J: ::core::default::Default +
Matcher<Z>, K: ::core::default::Default + Matcher<Z>,
L: ::core::default::Default + Matcher<Z>, M: ::core::default::Default +
Matcher<Z>, N: ::core::default::Default + Matcher<Z>,
O: ::core::default::Default + Matcher<Z>, P: ::core::default::Default +
Matcher<Z>> ::core::default::Default for
Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
#[inline]
fn default() -> Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
Or16(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>,
I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>, M: Matcher<Z>,
N: Matcher<Z>, O: Matcher<Z>, P: Matcher<Z>> Matcher<Z> for
Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Or8::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>,
Or<Z, I, J>, Or<Z, K, L>, Or<Z, M, N>,
Or<Z, O, P>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Or8::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>,
Or<Z, I, J>, Or<Z, K, L>, Or<Z, M, N>,
Or<Z, O, P>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Or8::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>,
Or<Z, I, J>, Or<Z, K, L>, Or<Z, M, N>,
Or<Z, O, P>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Or8::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>,
Or<Z, I, J>, Or<Z, K, L>, Or<Z, M, N>,
Or<Z, O, P>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>,
I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>, M: Matcher<Z>,
N: Matcher<Z>, O: Matcher<Z>, P: Matcher<Z>> Debug for
Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Or8::<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>,
Or<Z, I, J>, Or<Z, K, L>, Or<Z, M, N>,
Or<Z, O, P>>::default()))
}
}define_paired_n!(Or, Or16, Or8, [A B] [C D] [E F] [G H] [I J] [K L] [M N] [O P]);
172
173pub struct Then4<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>> ::core::default::Default for Then4<Z, A, B, C, D> {
#[inline]
fn default() -> Then4<Z, A, B, C, D> {
Then4(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>> Matcher<Z> for Then4<Z, A, B, C, D> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Then::<Z, Then<Z, A, B>, Then<Z, C, D>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Then::<Z, Then<Z, A, B>, Then<Z, C, D>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Then::<Z, Then<Z, A, B>, Then<Z, C, D>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Then::<Z, Then<Z, A, B>, Then<Z, C, D>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>> Debug for Then4<Z, A, B, C, D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Then::<Z, Then<Z, A, B>, Then<Z, C, D>>::default()))
}
}define_paired_n!(Then, Then4, Then, [A B] [C D]);
174pub struct Then8<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>,
H: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>, pub PhantomData<E>,
pub PhantomData<F>, pub PhantomData<G>, pub PhantomData<H>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>, E: ::core::default::Default + Matcher<Z>,
F: ::core::default::Default + Matcher<Z>, G: ::core::default::Default +
Matcher<Z>, H: ::core::default::Default + Matcher<Z>>
::core::default::Default for Then8<Z, A, B, C, D, E, F, G, H> {
#[inline]
fn default() -> Then8<Z, A, B, C, D, E, F, G, H> {
Then8(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>>
Matcher<Z> for Then8<Z, A, B, C, D, E, F, G, H> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Then4::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Then4::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Then4::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Then4::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>>
Debug for Then8<Z, A, B, C, D, E, F, G, H> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Then4::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>>::default()))
}
}define_paired_n!(Then, Then8, Then4, [A B] [C D] [E F] [G H]);
175pub struct Then16<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>,
C: Matcher<Z>, D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>,
H: Matcher<Z>, I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>,
M: Matcher<Z>, N: Matcher<Z>, O: Matcher<Z>,
P: Matcher<Z>>(pub PhantomData<Z>, pub PhantomData<A>, pub PhantomData<B>,
pub PhantomData<C>, pub PhantomData<D>, pub PhantomData<E>,
pub PhantomData<F>, pub PhantomData<G>, pub PhantomData<H>,
pub PhantomData<I>, pub PhantomData<J>, pub PhantomData<K>,
pub PhantomData<L>, pub PhantomData<M>, pub PhantomData<N>,
pub PhantomData<O>, pub PhantomData<P>);
#[automatically_derived]
impl<Z: ::core::default::Default + HaystackItem, A: ::core::default::Default +
Matcher<Z>, B: ::core::default::Default + Matcher<Z>,
C: ::core::default::Default + Matcher<Z>, D: ::core::default::Default +
Matcher<Z>, E: ::core::default::Default + Matcher<Z>,
F: ::core::default::Default + Matcher<Z>, G: ::core::default::Default +
Matcher<Z>, H: ::core::default::Default + Matcher<Z>,
I: ::core::default::Default + Matcher<Z>, J: ::core::default::Default +
Matcher<Z>, K: ::core::default::Default + Matcher<Z>,
L: ::core::default::Default + Matcher<Z>, M: ::core::default::Default +
Matcher<Z>, N: ::core::default::Default + Matcher<Z>,
O: ::core::default::Default + Matcher<Z>, P: ::core::default::Default +
Matcher<Z>> ::core::default::Default for
Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
#[inline]
fn default()
-> Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
Then16(::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default(),
::core::default::Default::default())
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>,
I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>, M: Matcher<Z>,
N: Matcher<Z>, O: Matcher<Z>, P: Matcher<Z>> Matcher<Z> for
Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
Then8::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>,
Then<Z, I, J>, Then<Z, K, L>, Then<Z, M, N>,
Then<Z, O, P>>::matches(hay)
}
fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Vec<usize> {
Then8::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>,
Then<Z, I, J>, Then<Z, K, L>, Then<Z, M, N>,
Then<Z, O, P>>::all_matches(hay)
}
fn captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> bool {
Then8::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>,
Then<Z, I, J>, Then<Z, K, L>, Then<Z, M, N>,
Then<Z, O, P>>::captures(hay, caps)
}
fn all_captures<'a,
Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures)
-> Vec<(usize, IndexedCaptures)> {
Then8::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>,
Then<Z, I, J>, Then<Z, K, L>, Then<Z, M, N>,
Then<Z, O, P>>::all_captures(hay, caps)
}
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
D: Matcher<Z>, E: Matcher<Z>, F: Matcher<Z>, G: Matcher<Z>, H: Matcher<Z>,
I: Matcher<Z>, J: Matcher<Z>, K: Matcher<Z>, L: Matcher<Z>, M: Matcher<Z>,
N: Matcher<Z>, O: Matcher<Z>, P: Matcher<Z>> Debug for
Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{0:?}",
Then8::<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>,
Then<Z, G, H>, Then<Z, I, J>, Then<Z, K, L>, Then<Z, M, N>,
Then<Z, O, P>>::default()))
}
}define_paired_n!(Then, Then16, Then8, [A B] [C D] [E F] [G H] [I J] [K L] [M N] [O P]);