1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use crate::registry::Registry;
use async_graphql::dynamic::TypeRef;
use std::borrow::Cow;
mod common;
pub trait Register {
#[inline]
fn register(registry: Registry) -> Registry {
registry
}
}
pub trait RegisterFns {
const REGISTER_FNS: &'static [fn(registry: Registry) -> Registry];
}
pub trait TypeName: Register {
fn get_type_name() -> Cow<'static, str>;
}
pub trait OutputTypeName: TypeName {
fn get_output_type_name() -> Cow<'static, str> {
<Self as TypeName>::get_type_name()
}
}
pub trait InputTypeName: TypeName {
fn get_input_type_name() -> Cow<'static, str> {
<Self as TypeName>::get_type_name()
}
}
pub trait Object: OutputTypeName + ParentType {
fn get_object_type_name() -> Cow<'static, str> {
<Self as OutputTypeName>::get_output_type_name()
}
}
pub trait Enum: OutputTypeName {
fn get_enum_type_name() -> Cow<'static, str> {
<Self as OutputTypeName>::get_output_type_name()
}
}
pub trait Scalar: OutputTypeName {
fn get_scalar_type_name() -> Cow<'static, str> {
<Self as OutputTypeName>::get_output_type_name()
}
}
pub trait Union: OutputTypeName {
fn get_union_type_name() -> Cow<'static, str> {
<Self as OutputTypeName>::get_output_type_name()
}
}
pub trait Interface: OutputTypeName {
fn get_interface_type_name() -> Cow<'static, str> {
<Self as OutputTypeName>::get_output_type_name()
}
}
pub trait ParentType {
type Type: Object;
}
pub trait InterfaceMark<T: Interface + ?Sized> {}
pub trait InputObject: InputTypeName {
fn get_input_object_type_name() -> Cow<'static, str> {
<Self as InputTypeName>::get_input_type_name()
}
}
pub trait Mutation: ExpandObject {}
pub trait ExpandObject: ParentType {
fn get_expand_object_name() -> Cow<'static, str>;
}
pub trait GetOutputTypeRef {
type Output: Into<TypeRef>;
fn get_output_type_ref() -> Self::Output;
}
pub trait GetInputTypeRef {
type Output: Into<TypeRef>;
fn get_input_type_ref() -> Self::Output;
}