bluejay_core/executable/
executable_document.rs

1use crate::executable::{
2    ExplicitOperationDefinition, Field, FragmentDefinition, FragmentSpread,
3    ImplicitOperationDefinition, InlineFragment, OperationDefinition, Selection, SelectionSet,
4    VariableDefinition, VariableDefinitions, VariableType,
5};
6use crate::{Argument, Arguments, Directive, Directives, Value};
7
8pub trait ExecutableDocument {
9    type Value<const CONST: bool>: Value<CONST>;
10    type VariableType: VariableType;
11    type Argument<const CONST: bool>: Argument<CONST, Value = Self::Value<CONST>>;
12    type Arguments<const CONST: bool>: Arguments<CONST, Argument = Self::Argument<CONST>>;
13    type Directive<const CONST: bool>: Directive<CONST, Arguments = Self::Arguments<CONST>>;
14    type Directives<const CONST: bool>: Directives<CONST, Directive = Self::Directive<CONST>>;
15    type FragmentSpread: FragmentSpread<Directives = Self::Directives<false>>;
16    type Field: Field<
17        Arguments = Self::Arguments<false>,
18        Directives = Self::Directives<false>,
19        SelectionSet = Self::SelectionSet,
20    >;
21    type Selection: Selection<
22        Field = Self::Field,
23        FragmentSpread = Self::FragmentSpread,
24        InlineFragment = Self::InlineFragment,
25    >;
26    type SelectionSet: SelectionSet<Selection = Self::Selection>;
27    type InlineFragment: InlineFragment<
28        Directives = Self::Directives<false>,
29        SelectionSet = Self::SelectionSet,
30    >;
31    type VariableDefinition: VariableDefinition<
32        VariableType = Self::VariableType,
33        Directives = Self::Directives<true>,
34        Value = Self::Value<true>,
35    >;
36    type VariableDefinitions: VariableDefinitions<VariableDefinition = Self::VariableDefinition>;
37    type ExplicitOperationDefinition: ExplicitOperationDefinition<
38        VariableDefinitions = Self::VariableDefinitions,
39        Directives = Self::Directives<false>,
40        SelectionSet = Self::SelectionSet,
41    >;
42    type ImplicitOperationDefinition: ImplicitOperationDefinition<SelectionSet = Self::SelectionSet>;
43    type OperationDefinition: OperationDefinition<
44        ExplicitOperationDefinition = Self::ExplicitOperationDefinition,
45        ImplicitOperationDefinition = Self::ImplicitOperationDefinition,
46    >;
47    type FragmentDefinition: FragmentDefinition<
48        Directives = Self::Directives<false>,
49        SelectionSet = Self::SelectionSet,
50    >;
51    type OperationDefinitions<'a>: Iterator<Item = &'a Self::OperationDefinition>
52    where
53        Self: 'a;
54    type FragmentDefinitions<'a>: Iterator<Item = &'a Self::FragmentDefinition>
55    where
56        Self: 'a;
57
58    fn operation_definitions(&self) -> Self::OperationDefinitions<'_>;
59    fn fragment_definitions(&self) -> Self::FragmentDefinitions<'_>;
60}