graphql_tools/
lib.rs

1//! graphql-tools
2//! ==============
3//!
4//! This library implements tooling around GraphQL for Rust libraries.
5//! Most of the tools are based on `trait`s and `struct`s implemented in `graphql_parser` crate.
6//!
7
8pub mod ast;
9
10pub mod static_graphql {
11    macro_rules! static_graphql {
12    ($m:ident, $m2:ident, {$($n:ident,)*}) => {
13        pub mod $m {
14            use crate::parser::$m2 as $m;
15            pub use $m::*;
16            $(
17                pub type $n = $m::$n<'static, String>;
18            )*
19        }
20    };
21  }
22
23    static_graphql!(query, query, {
24      Document, Value, OperationDefinition, InlineFragment, TypeCondition,
25      FragmentSpread, Field, Selection, SelectionSet, FragmentDefinition,
26      Directive, VariableDefinition, Type, Query, Definition, Subscription, Mutation,
27    });
28    static_graphql!(schema, schema, {
29      Field, Directive, InterfaceType, ObjectType, Value, TypeDefinition,
30      EnumType, Type, Document, ScalarType, InputValue, DirectiveDefinition,
31      UnionType, InputObjectType, EnumValue, SchemaDefinition,
32    });
33}
34
35pub mod introspection;
36
37pub mod validation;
38
39#[cfg(feature = "graphql_parser")]
40pub extern crate graphql_parser as parser;
41#[cfg(feature = "graphql_parser_fork")]
42pub extern crate graphql_parser_hive_fork as parser;