bluejay_validator/executable/document/
analyzer.rs

1use crate::executable::document::Visitor;
2use bluejay_core::definition::SchemaDefinition;
3use bluejay_core::executable::ExecutableDocument;
4
5pub trait Analyzer<'a, E: ExecutableDocument, S: SchemaDefinition>: Visitor<'a, E, S> {
6    type Output;
7
8    fn into_output(self) -> Self::Output;
9}
10
11macro_rules! impl_analyzer {
12    ($n:literal) => {
13        seq_macro::seq!(N in 0..$n {
14            impl<'a, E: ExecutableDocument, S: SchemaDefinition, #(T~N: Analyzer<'a, E, S>,)*> Analyzer<'a, E, S> for (#(T~N,)*) {
15                type Output = (#(T~N::Output,)*);
16
17                fn into_output(self) -> Self::Output {
18                    (
19                        #(self.N.into_output(),)*
20                    )
21                }
22            }
23        });
24    }
25}
26
27seq_macro::seq!(N in 2..=10 {
28    impl_analyzer!(N);
29});