Skip to main content

ct_regex_internal/matcher/
composite.rs

1use std::fmt::{self, Debug};
2use std::hash::Hash;
3use std::iter::{Chain, FusedIterator};
4use std::marker::PhantomData;
5
6use crate::expr::IndexedCaptures;
7use crate::haystack::{HaystackItem, HaystackOf};
8use crate::matcher::Matcher;
9use crate::sealed::Sealed;
10
11#[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, #[automatically_derived]
impl<I: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<I>, B: ::core::clone::Clone + Matcher<I>> ::core::clone::Clone for
    Or<I, A, B> {
    #[inline]
    fn clone(&self) -> Or<I, A, B> {
        Or(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2))
    }
}Clone, #[automatically_derived]
impl<I: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<I>, B: ::core::marker::Copy + Matcher<I>> ::core::marker::Copy for
    Or<I, A, B> {
}Copy)]
12pub struct Or<I: HaystackItem, A: Matcher<I>, B: Matcher<I>>(
13    pub(crate) PhantomData<I>,
14    pub(crate) PhantomData<A>,
15    pub(crate) PhantomData<B>,
16);
17
18pub type AllMatchesOr<'a, I, H, A, B> = Chain<
19    <A as Matcher<I>>::AllMatches<'a, H>,
20    <B as Matcher<I>>::AllMatches<'a, H>
21>;
22pub type AllCapturesOr<'a, I, H, A, B> = Chain<
23    <A as Matcher<I>>::AllCaptures<'a, H>,
24    <B as Matcher<I>>::AllCaptures<'a, H>
25>;
26
27impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Sealed for Or<I, A, B> {}
28
29impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Matcher<I> for Or<I, A, B> {
30    type AllMatches<'a, H: HaystackOf<'a, I>> = AllMatchesOr<'a, I, H, A, B>;
31    type AllCaptures<'a, H: HaystackOf<'a, I>> = AllCapturesOr<'a, I, H, A, B>;
32
33    fn matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool {
34        let start = hay.index();
35
36        if A::matches(hay) {
37            true
38        } else {
39            hay.rollback(start);
40            B::matches(hay)
41        }
42    }
43
44    // /(a*|b*)c/ should prefer aa, a, bb, b -> vec![b, bb, a, aa]
45    fn all_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> Self::AllMatches<'a, H> {
46        let state_fork = hay.index();
47        // There is no reversing anymore, yield elements in order of greediest to least greedy.
48        let a_matches = A::all_matches(hay);
49        hay.rollback(state_fork);
50        a_matches.chain(B::all_matches(hay))
51    }
52
53    fn captures<'a, H: HaystackOf<'a, I>>(hay: &mut H, caps: &mut IndexedCaptures) -> bool {
54        let (initial_state, initial_caps) = (hay.index(), caps.clone());
55        if A::captures(hay, caps) {
56            true
57        } else {
58            hay.rollback(initial_state);
59            *caps = initial_caps;
60            B::captures(hay, caps)
61        }
62    }
63
64    fn all_captures<'a, H: HaystackOf<'a, I>>(
65        hay: &mut H,
66        caps: &mut IndexedCaptures,
67    ) -> Self::AllCaptures<'a, H> {
68        let (state_fork, mut caps_fork) = (hay.index(), caps.clone());
69
70        let a_captures = A::all_captures(hay, caps);
71        hay.rollback(state_fork);
72        a_captures.chain(B::all_captures(hay, &mut caps_fork))
73    }
74}
75
76impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Debug for Or<I, A, B> {
77    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
78        f.write_fmt(format_args!("{0:?}|{1:?}", A::default(), B::default()))write!(f, "{:?}|{:?}", A::default(), B::default())
79    }
80}
81
82#[derive(#[automatically_derived]
impl<'a, I: ::core::fmt::Debug + HaystackItem, H: ::core::fmt::Debug +
    HaystackOf<'a, I>, A: ::core::fmt::Debug + Matcher<I>,
    B: ::core::fmt::Debug + Matcher<I>> ::core::fmt::Debug for
    AllMatchesThen<'a, I, H, A, B> where
    A::AllMatches<'a, H>: ::core::fmt::Debug,
    B::AllMatches<'a, H>: ::core::fmt::Debug {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "AllMatchesThen", "a_matches", &self.a_matches, "b_matches",
            &self.b_matches, "hay", &&self.hay)
    }
}Debug, #[automatically_derived]
impl<'a, I: ::core::clone::Clone + HaystackItem, H: ::core::clone::Clone +
    HaystackOf<'a, I>, A: ::core::clone::Clone + Matcher<I>,
    B: ::core::clone::Clone + Matcher<I>> ::core::clone::Clone for
    AllMatchesThen<'a, I, H, A, B> where
    A::AllMatches<'a, H>: ::core::clone::Clone,
    B::AllMatches<'a, H>: ::core::clone::Clone {
    #[inline]
    fn clone(&self) -> AllMatchesThen<'a, I, H, A, B> {
        AllMatchesThen {
            a_matches: ::core::clone::Clone::clone(&self.a_matches),
            b_matches: ::core::clone::Clone::clone(&self.b_matches),
            hay: ::core::clone::Clone::clone(&self.hay),
        }
    }
}Clone, #[automatically_derived]
impl<'a, I: ::core::hash::Hash + HaystackItem, H: ::core::hash::Hash +
    HaystackOf<'a, I>, A: ::core::hash::Hash + Matcher<I>,
    B: ::core::hash::Hash + Matcher<I>> ::core::hash::Hash for
    AllMatchesThen<'a, I, H, A, B> where
    A::AllMatches<'a, H>: ::core::hash::Hash,
    B::AllMatches<'a, H>: ::core::hash::Hash {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.a_matches, state);
        ::core::hash::Hash::hash(&self.b_matches, state);
        ::core::hash::Hash::hash(&self.hay, state)
    }
}Hash)]
83pub struct AllMatchesThen<'a, I: HaystackItem, H: HaystackOf<'a, I>, A: Matcher<I>, B: Matcher<I>> {
84    a_matches: A::AllMatches<'a, H>,
85    b_matches: Option<B::AllMatches<'a, H>>,
86    hay: H,
87}
88
89impl<'a, I, H, A, B> Iterator for AllMatchesThen<'a, I, H, A, B>
90where
91    I: HaystackItem,
92    H: HaystackOf<'a, I>,
93    A: Matcher<I>,
94    B: Matcher<I>,
95{
96    type Item = usize;
97
98    fn next(&mut self) -> Option<Self::Item> {
99        match self.b_matches.as_mut().and_then(Iterator::next) {
100            Some(b) => Some(b),
101            None => {
102                self.hay.rollback(self.a_matches.next()?);
103                self.b_matches = Some(B::all_matches(&mut self.hay));
104                self.next()
105            },
106        }
107    }
108}
109
110impl<'a, I, H, A, B> FusedIterator for AllMatchesThen<'a, I, H, A, B>
111where
112    I: HaystackItem,
113    H: HaystackOf<'a, I>,
114    A: Matcher<I>,
115    B: Matcher<I>,
116{}
117
118#[derive(#[automatically_derived]
impl<'a, I: ::core::fmt::Debug, H: ::core::fmt::Debug, A: ::core::fmt::Debug,
    B: ::core::fmt::Debug> ::core::fmt::Debug for
    AllCapturesThen<'a, I, H, A, B> where I: HaystackItem,
    H: HaystackOf<'a, I>, A: Matcher<I>, B: Matcher<I>,
    A::AllCaptures<'a, H>: ::core::fmt::Debug,
    B::AllCaptures<'a, H>: ::core::fmt::Debug {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "AllCapturesThen", "a_captures", &self.a_captures, "b_captures",
            &self.b_captures, "hay", &&self.hay)
    }
}Debug, #[automatically_derived]
impl<'a, I: ::core::clone::Clone, H: ::core::clone::Clone,
    A: ::core::clone::Clone, B: ::core::clone::Clone> ::core::clone::Clone for
    AllCapturesThen<'a, I, H, A, B> where I: HaystackItem,
    H: HaystackOf<'a, I>, A: Matcher<I>, B: Matcher<I>,
    A::AllCaptures<'a, H>: ::core::clone::Clone,
    B::AllCaptures<'a, H>: ::core::clone::Clone {
    #[inline]
    fn clone(&self) -> AllCapturesThen<'a, I, H, A, B> {
        AllCapturesThen {
            a_captures: ::core::clone::Clone::clone(&self.a_captures),
            b_captures: ::core::clone::Clone::clone(&self.b_captures),
            hay: ::core::clone::Clone::clone(&self.hay),
        }
    }
}Clone, #[automatically_derived]
impl<'a, I: ::core::hash::Hash, H: ::core::hash::Hash, A: ::core::hash::Hash,
    B: ::core::hash::Hash> ::core::hash::Hash for
    AllCapturesThen<'a, I, H, A, B> where I: HaystackItem,
    H: HaystackOf<'a, I>, A: Matcher<I>, B: Matcher<I>,
    A::AllCaptures<'a, H>: ::core::hash::Hash,
    B::AllCaptures<'a, H>: ::core::hash::Hash {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.a_captures, state);
        ::core::hash::Hash::hash(&self.b_captures, state);
        ::core::hash::Hash::hash(&self.hay, state)
    }
}Hash)]
119pub struct AllCapturesThen<'a, I, H, A, B>
120where
121    I: HaystackItem,
122    H: HaystackOf<'a, I>,
123    A: Matcher<I>,
124    B: Matcher<I>,
125{
126    a_captures: A::AllCaptures<'a, H>,
127    b_captures: Option<B::AllCaptures<'a, H>>,
128    hay: H,
129}
130
131impl<'a, I, H, A, B> Iterator for AllCapturesThen<'a, I, H, A, B>
132where
133    I: HaystackItem,
134    H: HaystackOf<'a, I>,
135    A: Matcher<I>,
136    B: Matcher<I>,
137{
138    type Item = (usize, IndexedCaptures);
139
140    fn next(&mut self) -> Option<Self::Item> {
141        match self.b_captures.as_mut().and_then(Iterator::next) {
142            Some(b) => Some(b),
143            None => {
144                let (state_fork, mut caps_fork) = self.a_captures.next()?;
145                self.hay.rollback(state_fork);
146                self.b_captures = Some(B::all_captures(&mut self.hay, &mut caps_fork));
147                self.next()
148            },
149        }
150    }
151}
152
153impl<'a, I, H, A, B> FusedIterator for AllCapturesThen<'a, I, H, A, B>
154where
155    I: HaystackItem,
156    H: HaystackOf<'a, I>,
157    A: Matcher<I>,
158    B: Matcher<I>,
159{}
160
161#[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, #[automatically_derived]
impl<I: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<I>, B: ::core::clone::Clone + Matcher<I>> ::core::clone::Clone for
    Then<I, A, B> {
    #[inline]
    fn clone(&self) -> Then<I, A, B> {
        Then(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2))
    }
}Clone, #[automatically_derived]
impl<I: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<I>, B: ::core::marker::Copy + Matcher<I>> ::core::marker::Copy for
    Then<I, A, B> {
}Copy)]
162pub struct Then<I: HaystackItem, A: Matcher<I>, B: Matcher<I>>(
163    pub(crate) PhantomData<I>,
164    pub(crate) PhantomData<A>,
165    pub(crate) PhantomData<B>,
166);
167
168impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Sealed for Then<I, A, B> {}
169
170impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Matcher<I> for Then<I, A, B> {
171    type AllMatches<'a, H: HaystackOf<'a, I>> = AllMatchesThen<'a, I, H, A, B>;
172    type AllCaptures<'a, H: HaystackOf<'a, I>> = AllCapturesThen<'a, I, H, A, B>;
173
174    fn matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool {
175        if let Some(state_fork) = Self::all_matches(hay).next() {
176            hay.rollback(state_fork);
177            true
178        } else {
179            false
180        }
181    }
182
183    fn all_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> Self::AllMatches<'a, H> {
184        AllMatchesThen {
185            a_matches: A::all_matches(hay),
186            b_matches: None,
187            // The state of hay is unspecified because we're forking. Therefore, we just clone hay
188            // to remove the need for (very) complicated lifetime bounds.
189            hay: hay.clone(),
190        }
191    }
192
193    fn captures<'a, H: HaystackOf<'a, I>>(hay: &mut H, caps: &mut IndexedCaptures) -> bool {
194        if let Some((state_fork, caps_fork)) = Self::all_captures(hay, caps).next() {
195            hay.rollback(state_fork);
196            *caps = caps_fork;
197            true
198        } else {
199            false
200        }
201    }
202
203    fn all_captures<'a, H: HaystackOf<'a, I>>(
204        hay: &mut H,
205        caps: &mut IndexedCaptures,
206    ) -> Self::AllCaptures<'a, H> {
207        AllCapturesThen {
208            a_captures: A::all_captures(hay, caps),
209            b_captures: None,
210            hay: hay.clone(),
211        }
212    }
213}
214
215impl<I: HaystackItem, A: Matcher<I>, B: Matcher<I>> Debug for Then<I, A, B> {
216    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
217        f.write_fmt(format_args!("{0:?}{1:?}", A::default(), B::default()))write!(f, "{:?}{:?}", A::default(), B::default())
218    }
219}
220
221/// Macro to generate chunked Or types (Or4, Or8, Or16, etc.)
222///
223/// Each generated type takes N matchers and combines them pairwise using Or,
224/// then delegates to the combiner type (which has N/2 parameters).
225///
226/// Usage: `define_or_n!(Or4, Or, [A B] [C D]);`
227/// - First arg: name of the new type
228/// - Second arg: the combiner type (Or for Or4, Or4 for Or8, etc.)
229/// - Remaining args: pairs of type parameter names in brackets
230macro_rules! define_paired_n {
231    ($pair:ident, $all_matches:ident, $name:ident, $combiner:ident, $([$a:ident $b:ident])+) => {
232        #[derive(Default, Clone, Copy)]
233        pub struct $name<
234            Z: HaystackItem,
235            $($a: Matcher<Z>, $b: Matcher<Z>),+
236        >(
237            pub PhantomData<Z>,
238            $(pub PhantomData<$a>, pub PhantomData<$b>),+
239        );
240
241        impl<
242            Z: HaystackItem,
243            $($a: Matcher<Z>, $b: Matcher<Z>),+
244        > Sealed for $name<Z, $($a, $b),+> {}
245
246        impl<
247            Z: HaystackItem,
248            $($a: Matcher<Z>, $b: Matcher<Z>),+
249        > Matcher<Z> for $name<Z, $($a, $b),+> {
250            type AllMatches<'a, Y: HaystackOf<'a, Z>> = <
251                $combiner::<Z, $($pair<Z, $a, $b>),+> as Matcher<Z>
252            >::AllMatches<'a, Y>;
253
254            type AllCaptures<'a, Y: HaystackOf<'a, Z>> = <
255                $combiner::<Z, $($pair<Z, $a, $b>),+> as Matcher<Z>
256            >::AllCaptures<'a, Y>;
257
258            fn matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> bool {
259                $combiner::<Z, $($pair<Z, $a, $b>),+>::matches(hay)
260            }
261
262            fn all_matches<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y) -> Self::AllMatches<'a, Y> {
263                $combiner::<Z, $($pair<Z, $a, $b>),+>::all_matches(hay)
264            }
265
266            fn captures<'a, Y: HaystackOf<'a, Z>>(hay: &mut Y, caps: &mut IndexedCaptures) -> bool {
267                $combiner::<Z, $($pair<Z, $a, $b>),+>::captures(hay, caps)
268            }
269
270            fn all_captures<'a, Y: HaystackOf<'a, Z>>(
271                hay: &mut Y,
272                caps: &mut IndexedCaptures
273            ) -> Self::AllCaptures<'a, Y> {
274                $combiner::<Z, $($pair<Z, $a, $b>),+>::all_captures(hay, caps)
275            }
276        }
277
278        impl<Z: HaystackItem, $($a: Matcher<Z>, $b: Matcher<Z>),+> Debug for $name<Z, $($a, $b),+> {
279            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
280                write!(f, "{:?}", $combiner::<Z, $($pair<Z, $a, $b>),+>::default())
281            }
282        }
283    };
284}
285
286pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>> ::core::clone::Clone for Or4<Z, A, B, C, D> {
    #[inline]
    fn clone(&self) -> Or4<Z, A, B, C, D> {
        Or4(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>> ::core::marker::Copy for Or4<Z, A, B, C, D> {
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
    D: Matcher<Z>> Sealed for Or4<Z, A, B, C, D> {}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
    D: Matcher<Z>> Matcher<Z> for Or4<Z, A, B, C, D> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <Or<Z, Or<Z, A, B>, Or<Z, C, D>> as Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <Or<Z, Or<Z, A, B>, Or<Z, C, D>> as Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesOr, Or4, Or, [A B] [C D]);
287pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>, E: ::core::clone::Clone + Matcher<Z>,
    F: ::core::clone::Clone + Matcher<Z>, G: ::core::clone::Clone +
    Matcher<Z>, H: ::core::clone::Clone + Matcher<Z>> ::core::clone::Clone for
    Or8<Z, A, B, C, D, E, F, G, H> {
    #[inline]
    fn clone(&self) -> Or8<Z, A, B, C, D, E, F, G, H> {
        Or8(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4),
            ::core::clone::Clone::clone(&self.5),
            ::core::clone::Clone::clone(&self.6),
            ::core::clone::Clone::clone(&self.7),
            ::core::clone::Clone::clone(&self.8))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>, E: ::core::marker::Copy + Matcher<Z>,
    F: ::core::marker::Copy + Matcher<Z>, G: ::core::marker::Copy +
    Matcher<Z>, H: ::core::marker::Copy + Matcher<Z>> ::core::marker::Copy for
    Or8<Z, A, B, C, D, E, F, G, H> {
}
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>>
    Sealed for Or8<Z, A, B, C, D, E, F, G, H> {}
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> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <Or4<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>> as
        Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <Or4<Z, Or<Z, A, B>, Or<Z, C, D>, Or<Z, E, F>, Or<Z, G, H>> as
        Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesOr, Or8, Or4, [A B] [C D] [E F] [G H]);
288pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>, E: ::core::clone::Clone + Matcher<Z>,
    F: ::core::clone::Clone + Matcher<Z>, G: ::core::clone::Clone +
    Matcher<Z>, H: ::core::clone::Clone + Matcher<Z>,
    I: ::core::clone::Clone + Matcher<Z>, J: ::core::clone::Clone +
    Matcher<Z>, K: ::core::clone::Clone + Matcher<Z>,
    L: ::core::clone::Clone + Matcher<Z>, M: ::core::clone::Clone +
    Matcher<Z>, N: ::core::clone::Clone + Matcher<Z>,
    O: ::core::clone::Clone + Matcher<Z>, P: ::core::clone::Clone +
    Matcher<Z>> ::core::clone::Clone for
    Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
    #[inline]
    fn clone(&self)
        -> Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
        Or16(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4),
            ::core::clone::Clone::clone(&self.5),
            ::core::clone::Clone::clone(&self.6),
            ::core::clone::Clone::clone(&self.7),
            ::core::clone::Clone::clone(&self.8),
            ::core::clone::Clone::clone(&self.9),
            ::core::clone::Clone::clone(&self.10),
            ::core::clone::Clone::clone(&self.11),
            ::core::clone::Clone::clone(&self.12),
            ::core::clone::Clone::clone(&self.13),
            ::core::clone::Clone::clone(&self.14),
            ::core::clone::Clone::clone(&self.15),
            ::core::clone::Clone::clone(&self.16))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>, E: ::core::marker::Copy + Matcher<Z>,
    F: ::core::marker::Copy + Matcher<Z>, G: ::core::marker::Copy +
    Matcher<Z>, H: ::core::marker::Copy + Matcher<Z>,
    I: ::core::marker::Copy + Matcher<Z>, J: ::core::marker::Copy +
    Matcher<Z>, K: ::core::marker::Copy + Matcher<Z>,
    L: ::core::marker::Copy + Matcher<Z>, M: ::core::marker::Copy +
    Matcher<Z>, N: ::core::marker::Copy + Matcher<Z>,
    O: ::core::marker::Copy + Matcher<Z>, P: ::core::marker::Copy +
    Matcher<Z>> ::core::marker::Copy for
    Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
}
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>> Sealed for
    Or16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {}
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> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <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>> as
        Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <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>> as
        Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesOr, Or16, Or8, [A B] [C D] [E F] [G H] [I J] [K L] [M N] [O P]);
289
290pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>> ::core::clone::Clone for Then4<Z, A, B, C, D> {
    #[inline]
    fn clone(&self) -> Then4<Z, A, B, C, D> {
        Then4(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>> ::core::marker::Copy for Then4<Z, A, B, C, D> {
}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
    D: Matcher<Z>> Sealed for Then4<Z, A, B, C, D> {}
impl<Z: HaystackItem, A: Matcher<Z>, B: Matcher<Z>, C: Matcher<Z>,
    D: Matcher<Z>> Matcher<Z> for Then4<Z, A, B, C, D> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <Then<Z, Then<Z, A, B>, Then<Z, C, D>> as
        Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <Then<Z, Then<Z, A, B>, Then<Z, C, D>> as
        Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesThen, Then4, Then, [A B] [C D]);
291pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>, E: ::core::clone::Clone + Matcher<Z>,
    F: ::core::clone::Clone + Matcher<Z>, G: ::core::clone::Clone +
    Matcher<Z>, H: ::core::clone::Clone + Matcher<Z>> ::core::clone::Clone for
    Then8<Z, A, B, C, D, E, F, G, H> {
    #[inline]
    fn clone(&self) -> Then8<Z, A, B, C, D, E, F, G, H> {
        Then8(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4),
            ::core::clone::Clone::clone(&self.5),
            ::core::clone::Clone::clone(&self.6),
            ::core::clone::Clone::clone(&self.7),
            ::core::clone::Clone::clone(&self.8))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>, E: ::core::marker::Copy + Matcher<Z>,
    F: ::core::marker::Copy + Matcher<Z>, G: ::core::marker::Copy +
    Matcher<Z>, H: ::core::marker::Copy + Matcher<Z>> ::core::marker::Copy for
    Then8<Z, A, B, C, D, E, F, G, H> {
}
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>>
    Sealed for Then8<Z, A, B, C, D, E, F, G, H> {}
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> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <Then4<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>>
        as Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <Then4<Z, Then<Z, A, B>, Then<Z, C, D>, Then<Z, E, F>, Then<Z, G, H>>
        as Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesThen, Then8, Then4, [A B] [C D] [E F] [G H]);
292pub 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())
    }
}
#[automatically_derived]
impl<Z: ::core::clone::Clone + HaystackItem, A: ::core::clone::Clone +
    Matcher<Z>, B: ::core::clone::Clone + Matcher<Z>,
    C: ::core::clone::Clone + Matcher<Z>, D: ::core::clone::Clone +
    Matcher<Z>, E: ::core::clone::Clone + Matcher<Z>,
    F: ::core::clone::Clone + Matcher<Z>, G: ::core::clone::Clone +
    Matcher<Z>, H: ::core::clone::Clone + Matcher<Z>,
    I: ::core::clone::Clone + Matcher<Z>, J: ::core::clone::Clone +
    Matcher<Z>, K: ::core::clone::Clone + Matcher<Z>,
    L: ::core::clone::Clone + Matcher<Z>, M: ::core::clone::Clone +
    Matcher<Z>, N: ::core::clone::Clone + Matcher<Z>,
    O: ::core::clone::Clone + Matcher<Z>, P: ::core::clone::Clone +
    Matcher<Z>> ::core::clone::Clone for
    Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
    #[inline]
    fn clone(&self)
        -> Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
        Then16(::core::clone::Clone::clone(&self.0),
            ::core::clone::Clone::clone(&self.1),
            ::core::clone::Clone::clone(&self.2),
            ::core::clone::Clone::clone(&self.3),
            ::core::clone::Clone::clone(&self.4),
            ::core::clone::Clone::clone(&self.5),
            ::core::clone::Clone::clone(&self.6),
            ::core::clone::Clone::clone(&self.7),
            ::core::clone::Clone::clone(&self.8),
            ::core::clone::Clone::clone(&self.9),
            ::core::clone::Clone::clone(&self.10),
            ::core::clone::Clone::clone(&self.11),
            ::core::clone::Clone::clone(&self.12),
            ::core::clone::Clone::clone(&self.13),
            ::core::clone::Clone::clone(&self.14),
            ::core::clone::Clone::clone(&self.15),
            ::core::clone::Clone::clone(&self.16))
    }
}
#[automatically_derived]
impl<Z: ::core::marker::Copy + HaystackItem, A: ::core::marker::Copy +
    Matcher<Z>, B: ::core::marker::Copy + Matcher<Z>,
    C: ::core::marker::Copy + Matcher<Z>, D: ::core::marker::Copy +
    Matcher<Z>, E: ::core::marker::Copy + Matcher<Z>,
    F: ::core::marker::Copy + Matcher<Z>, G: ::core::marker::Copy +
    Matcher<Z>, H: ::core::marker::Copy + Matcher<Z>,
    I: ::core::marker::Copy + Matcher<Z>, J: ::core::marker::Copy +
    Matcher<Z>, K: ::core::marker::Copy + Matcher<Z>,
    L: ::core::marker::Copy + Matcher<Z>, M: ::core::marker::Copy +
    Matcher<Z>, N: ::core::marker::Copy + Matcher<Z>,
    O: ::core::marker::Copy + Matcher<Z>, P: ::core::marker::Copy +
    Matcher<Z>> ::core::marker::Copy for
    Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {
}
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>> Sealed for
    Then16<Z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> {}
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> {
    type AllMatches<'a, Y: HaystackOf<'a, Z>> =
        <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>> as
        Matcher<Z>>::AllMatches<'a, Y>;
    type AllCaptures<'a, Y: HaystackOf<'a, Z>> =
        <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>> as
        Matcher<Z>>::AllCaptures<'a, Y>;
    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)
        -> Self::AllMatches<'a, Y> {
        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)
        -> Self::AllCaptures<'a, Y> {
        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, AllMatchesThen, Then16, Then8, [A B] [C D] [E F] [G H] [I J] [K L] [M N] [O P]);