1use crate::cst::support;
5use crate::cst::CstChildren;
6use crate::cst::CstNode;
7use crate::SyntaxKind;
8use crate::SyntaxKind::*;
9use crate::SyntaxNode;
10use crate::SyntaxToken;
11use crate::S;
12#[derive(Debug, Clone, PartialEq, Eq, Hash)]
13pub struct Name {
14 pub(crate) syntax: SyntaxNode,
15}
16impl Name {
17 pub fn ident_token(&self) -> Option<SyntaxToken> {
18 support::token(&self.syntax, S![ident])
19 }
20}
21#[derive(Debug, Clone, PartialEq, Eq, Hash)]
22pub struct Document {
23 pub(crate) syntax: SyntaxNode,
24}
25impl Document {
26 pub fn definitions(&self) -> CstChildren<Definition> {
27 support::children(&self.syntax)
28 }
29}
30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
31pub struct OperationDefinition {
32 pub(crate) syntax: SyntaxNode,
33}
34impl OperationDefinition {
35 pub fn operation_type(&self) -> Option<OperationType> {
36 support::child(&self.syntax)
37 }
38 pub fn name(&self) -> Option<Name> {
39 support::child(&self.syntax)
40 }
41 pub fn variable_definitions(&self) -> Option<VariableDefinitions> {
42 support::child(&self.syntax)
43 }
44 pub fn directives(&self) -> Option<Directives> {
45 support::child(&self.syntax)
46 }
47 pub fn selection_set(&self) -> Option<SelectionSet> {
48 support::child(&self.syntax)
49 }
50}
51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
52pub struct FragmentDefinition {
53 pub(crate) syntax: SyntaxNode,
54}
55impl FragmentDefinition {
56 pub fn fragment_token(&self) -> Option<SyntaxToken> {
57 support::token(&self.syntax, S![fragment])
58 }
59 pub fn fragment_name(&self) -> Option<FragmentName> {
60 support::child(&self.syntax)
61 }
62 pub fn type_condition(&self) -> Option<TypeCondition> {
63 support::child(&self.syntax)
64 }
65 pub fn directives(&self) -> Option<Directives> {
66 support::child(&self.syntax)
67 }
68 pub fn selection_set(&self) -> Option<SelectionSet> {
69 support::child(&self.syntax)
70 }
71}
72#[derive(Debug, Clone, PartialEq, Eq, Hash)]
73pub struct DirectiveDefinition {
74 pub(crate) syntax: SyntaxNode,
75}
76impl DirectiveDefinition {
77 pub fn description(&self) -> Option<Description> {
78 support::child(&self.syntax)
79 }
80 pub fn directive_token(&self) -> Option<SyntaxToken> {
81 support::token(&self.syntax, S![directive])
82 }
83 pub fn at_token(&self) -> Option<SyntaxToken> {
84 support::token(&self.syntax, S![@])
85 }
86 pub fn name(&self) -> Option<Name> {
87 support::child(&self.syntax)
88 }
89 pub fn arguments_definition(&self) -> Option<ArgumentsDefinition> {
90 support::child(&self.syntax)
91 }
92 pub fn directives(&self) -> Option<Directives> {
93 support::child(&self.syntax)
94 }
95 pub fn repeatable_token(&self) -> Option<SyntaxToken> {
96 support::token(&self.syntax, S![repeatable])
97 }
98 pub fn on_token(&self) -> Option<SyntaxToken> {
99 support::token(&self.syntax, S![on])
100 }
101 pub fn directive_locations(&self) -> Option<DirectiveLocations> {
102 support::child(&self.syntax)
103 }
104}
105#[derive(Debug, Clone, PartialEq, Eq, Hash)]
106pub struct SchemaDefinition {
107 pub(crate) syntax: SyntaxNode,
108}
109impl SchemaDefinition {
110 pub fn description(&self) -> Option<Description> {
111 support::child(&self.syntax)
112 }
113 pub fn schema_token(&self) -> Option<SyntaxToken> {
114 support::token(&self.syntax, S![schema])
115 }
116 pub fn directives(&self) -> Option<Directives> {
117 support::child(&self.syntax)
118 }
119 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
120 support::token(&self.syntax, S!['{'])
121 }
122 pub fn root_operation_type_definitions(&self) -> CstChildren<RootOperationTypeDefinition> {
123 support::children(&self.syntax)
124 }
125 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
126 support::token(&self.syntax, S!['}'])
127 }
128}
129#[derive(Debug, Clone, PartialEq, Eq, Hash)]
130pub struct ScalarTypeDefinition {
131 pub(crate) syntax: SyntaxNode,
132}
133impl ScalarTypeDefinition {
134 pub fn description(&self) -> Option<Description> {
135 support::child(&self.syntax)
136 }
137 pub fn scalar_token(&self) -> Option<SyntaxToken> {
138 support::token(&self.syntax, S![scalar])
139 }
140 pub fn name(&self) -> Option<Name> {
141 support::child(&self.syntax)
142 }
143 pub fn directives(&self) -> Option<Directives> {
144 support::child(&self.syntax)
145 }
146}
147#[derive(Debug, Clone, PartialEq, Eq, Hash)]
148pub struct ObjectTypeDefinition {
149 pub(crate) syntax: SyntaxNode,
150}
151impl ObjectTypeDefinition {
152 pub fn description(&self) -> Option<Description> {
153 support::child(&self.syntax)
154 }
155 pub fn type_token(&self) -> Option<SyntaxToken> {
156 support::token(&self.syntax, S![type])
157 }
158 pub fn name(&self) -> Option<Name> {
159 support::child(&self.syntax)
160 }
161 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
162 support::child(&self.syntax)
163 }
164 pub fn directives(&self) -> Option<Directives> {
165 support::child(&self.syntax)
166 }
167 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
168 support::child(&self.syntax)
169 }
170}
171#[derive(Debug, Clone, PartialEq, Eq, Hash)]
172pub struct InterfaceTypeDefinition {
173 pub(crate) syntax: SyntaxNode,
174}
175impl InterfaceTypeDefinition {
176 pub fn description(&self) -> Option<Description> {
177 support::child(&self.syntax)
178 }
179 pub fn interface_token(&self) -> Option<SyntaxToken> {
180 support::token(&self.syntax, S![interface])
181 }
182 pub fn name(&self) -> Option<Name> {
183 support::child(&self.syntax)
184 }
185 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
186 support::child(&self.syntax)
187 }
188 pub fn directives(&self) -> Option<Directives> {
189 support::child(&self.syntax)
190 }
191 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
192 support::child(&self.syntax)
193 }
194}
195#[derive(Debug, Clone, PartialEq, Eq, Hash)]
196pub struct UnionTypeDefinition {
197 pub(crate) syntax: SyntaxNode,
198}
199impl UnionTypeDefinition {
200 pub fn description(&self) -> Option<Description> {
201 support::child(&self.syntax)
202 }
203 pub fn union_token(&self) -> Option<SyntaxToken> {
204 support::token(&self.syntax, S![union])
205 }
206 pub fn name(&self) -> Option<Name> {
207 support::child(&self.syntax)
208 }
209 pub fn directives(&self) -> Option<Directives> {
210 support::child(&self.syntax)
211 }
212 pub fn union_member_types(&self) -> Option<UnionMemberTypes> {
213 support::child(&self.syntax)
214 }
215}
216#[derive(Debug, Clone, PartialEq, Eq, Hash)]
217pub struct EnumTypeDefinition {
218 pub(crate) syntax: SyntaxNode,
219}
220impl EnumTypeDefinition {
221 pub fn description(&self) -> Option<Description> {
222 support::child(&self.syntax)
223 }
224 pub fn enum_token(&self) -> Option<SyntaxToken> {
225 support::token(&self.syntax, S![enum])
226 }
227 pub fn name(&self) -> Option<Name> {
228 support::child(&self.syntax)
229 }
230 pub fn directives(&self) -> Option<Directives> {
231 support::child(&self.syntax)
232 }
233 pub fn enum_values_definition(&self) -> Option<EnumValuesDefinition> {
234 support::child(&self.syntax)
235 }
236}
237#[derive(Debug, Clone, PartialEq, Eq, Hash)]
238pub struct InputObjectTypeDefinition {
239 pub(crate) syntax: SyntaxNode,
240}
241impl InputObjectTypeDefinition {
242 pub fn description(&self) -> Option<Description> {
243 support::child(&self.syntax)
244 }
245 pub fn input_token(&self) -> Option<SyntaxToken> {
246 support::token(&self.syntax, S![input])
247 }
248 pub fn name(&self) -> Option<Name> {
249 support::child(&self.syntax)
250 }
251 pub fn directives(&self) -> Option<Directives> {
252 support::child(&self.syntax)
253 }
254 pub fn input_fields_definition(&self) -> Option<InputFieldsDefinition> {
255 support::child(&self.syntax)
256 }
257}
258#[derive(Debug, Clone, PartialEq, Eq, Hash)]
259pub struct SchemaExtension {
260 pub(crate) syntax: SyntaxNode,
261}
262impl SchemaExtension {
263 pub fn extend_token(&self) -> Option<SyntaxToken> {
264 support::token(&self.syntax, S![extend])
265 }
266 pub fn schema_token(&self) -> Option<SyntaxToken> {
267 support::token(&self.syntax, S![schema])
268 }
269 pub fn directives(&self) -> Option<Directives> {
270 support::child(&self.syntax)
271 }
272 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
273 support::token(&self.syntax, S!['{'])
274 }
275 pub fn root_operation_type_definitions(&self) -> CstChildren<RootOperationTypeDefinition> {
276 support::children(&self.syntax)
277 }
278 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
279 support::token(&self.syntax, S!['}'])
280 }
281}
282#[derive(Debug, Clone, PartialEq, Eq, Hash)]
283pub struct DirectiveExtension {
284 pub(crate) syntax: SyntaxNode,
285}
286impl DirectiveExtension {
287 pub fn extend_token(&self) -> Option<SyntaxToken> {
288 support::token(&self.syntax, S![extend])
289 }
290 pub fn directive_token(&self) -> Option<SyntaxToken> {
291 support::token(&self.syntax, S![directive])
292 }
293 pub fn at_token(&self) -> Option<SyntaxToken> {
294 support::token(&self.syntax, S![@])
295 }
296 pub fn name(&self) -> Option<Name> {
297 support::child(&self.syntax)
298 }
299 pub fn directives(&self) -> Option<Directives> {
300 support::child(&self.syntax)
301 }
302}
303#[derive(Debug, Clone, PartialEq, Eq, Hash)]
304pub struct ScalarTypeExtension {
305 pub(crate) syntax: SyntaxNode,
306}
307impl ScalarTypeExtension {
308 pub fn extend_token(&self) -> Option<SyntaxToken> {
309 support::token(&self.syntax, S![extend])
310 }
311 pub fn scalar_token(&self) -> Option<SyntaxToken> {
312 support::token(&self.syntax, S![scalar])
313 }
314 pub fn name(&self) -> Option<Name> {
315 support::child(&self.syntax)
316 }
317 pub fn directives(&self) -> Option<Directives> {
318 support::child(&self.syntax)
319 }
320}
321#[derive(Debug, Clone, PartialEq, Eq, Hash)]
322pub struct ObjectTypeExtension {
323 pub(crate) syntax: SyntaxNode,
324}
325impl ObjectTypeExtension {
326 pub fn extend_token(&self) -> Option<SyntaxToken> {
327 support::token(&self.syntax, S![extend])
328 }
329 pub fn type_token(&self) -> Option<SyntaxToken> {
330 support::token(&self.syntax, S![type])
331 }
332 pub fn name(&self) -> Option<Name> {
333 support::child(&self.syntax)
334 }
335 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
336 support::child(&self.syntax)
337 }
338 pub fn directives(&self) -> Option<Directives> {
339 support::child(&self.syntax)
340 }
341 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
342 support::child(&self.syntax)
343 }
344}
345#[derive(Debug, Clone, PartialEq, Eq, Hash)]
346pub struct InterfaceTypeExtension {
347 pub(crate) syntax: SyntaxNode,
348}
349impl InterfaceTypeExtension {
350 pub fn extend_token(&self) -> Option<SyntaxToken> {
351 support::token(&self.syntax, S![extend])
352 }
353 pub fn interface_token(&self) -> Option<SyntaxToken> {
354 support::token(&self.syntax, S![interface])
355 }
356 pub fn name(&self) -> Option<Name> {
357 support::child(&self.syntax)
358 }
359 pub fn implements_interfaces(&self) -> Option<ImplementsInterfaces> {
360 support::child(&self.syntax)
361 }
362 pub fn directives(&self) -> Option<Directives> {
363 support::child(&self.syntax)
364 }
365 pub fn fields_definition(&self) -> Option<FieldsDefinition> {
366 support::child(&self.syntax)
367 }
368}
369#[derive(Debug, Clone, PartialEq, Eq, Hash)]
370pub struct UnionTypeExtension {
371 pub(crate) syntax: SyntaxNode,
372}
373impl UnionTypeExtension {
374 pub fn extend_token(&self) -> Option<SyntaxToken> {
375 support::token(&self.syntax, S![extend])
376 }
377 pub fn union_token(&self) -> Option<SyntaxToken> {
378 support::token(&self.syntax, S![union])
379 }
380 pub fn name(&self) -> Option<Name> {
381 support::child(&self.syntax)
382 }
383 pub fn directives(&self) -> Option<Directives> {
384 support::child(&self.syntax)
385 }
386 pub fn union_member_types(&self) -> Option<UnionMemberTypes> {
387 support::child(&self.syntax)
388 }
389}
390#[derive(Debug, Clone, PartialEq, Eq, Hash)]
391pub struct EnumTypeExtension {
392 pub(crate) syntax: SyntaxNode,
393}
394impl EnumTypeExtension {
395 pub fn extend_token(&self) -> Option<SyntaxToken> {
396 support::token(&self.syntax, S![extend])
397 }
398 pub fn enum_token(&self) -> Option<SyntaxToken> {
399 support::token(&self.syntax, S![enum])
400 }
401 pub fn name(&self) -> Option<Name> {
402 support::child(&self.syntax)
403 }
404 pub fn directives(&self) -> Option<Directives> {
405 support::child(&self.syntax)
406 }
407 pub fn enum_values_definition(&self) -> Option<EnumValuesDefinition> {
408 support::child(&self.syntax)
409 }
410}
411#[derive(Debug, Clone, PartialEq, Eq, Hash)]
412pub struct InputObjectTypeExtension {
413 pub(crate) syntax: SyntaxNode,
414}
415impl InputObjectTypeExtension {
416 pub fn extend_token(&self) -> Option<SyntaxToken> {
417 support::token(&self.syntax, S![extend])
418 }
419 pub fn input_token(&self) -> Option<SyntaxToken> {
420 support::token(&self.syntax, S![input])
421 }
422 pub fn name(&self) -> Option<Name> {
423 support::child(&self.syntax)
424 }
425 pub fn directives(&self) -> Option<Directives> {
426 support::child(&self.syntax)
427 }
428 pub fn input_fields_definition(&self) -> Option<InputFieldsDefinition> {
429 support::child(&self.syntax)
430 }
431}
432#[derive(Debug, Clone, PartialEq, Eq, Hash)]
433pub struct OperationType {
434 pub(crate) syntax: SyntaxNode,
435}
436impl OperationType {
437 pub fn query_token(&self) -> Option<SyntaxToken> {
438 support::token(&self.syntax, S![query])
439 }
440 pub fn mutation_token(&self) -> Option<SyntaxToken> {
441 support::token(&self.syntax, S![mutation])
442 }
443 pub fn subscription_token(&self) -> Option<SyntaxToken> {
444 support::token(&self.syntax, S![subscription])
445 }
446}
447#[derive(Debug, Clone, PartialEq, Eq, Hash)]
448pub struct VariableDefinitions {
449 pub(crate) syntax: SyntaxNode,
450}
451impl VariableDefinitions {
452 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
453 support::token(&self.syntax, S!['('])
454 }
455 pub fn variable_definitions(&self) -> CstChildren<VariableDefinition> {
456 support::children(&self.syntax)
457 }
458 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
459 support::token(&self.syntax, S![')'])
460 }
461}
462#[derive(Debug, Clone, PartialEq, Eq, Hash)]
463pub struct Directives {
464 pub(crate) syntax: SyntaxNode,
465}
466impl Directives {
467 pub fn directives(&self) -> CstChildren<Directive> {
468 support::children(&self.syntax)
469 }
470}
471#[derive(Debug, Clone, PartialEq, Eq, Hash)]
472pub struct SelectionSet {
473 pub(crate) syntax: SyntaxNode,
474}
475impl SelectionSet {
476 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
477 support::token(&self.syntax, S!['{'])
478 }
479 pub fn selections(&self) -> CstChildren<Selection> {
480 support::children(&self.syntax)
481 }
482 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
483 support::token(&self.syntax, S!['}'])
484 }
485}
486#[derive(Debug, Clone, PartialEq, Eq, Hash)]
487pub struct Field {
488 pub(crate) syntax: SyntaxNode,
489}
490impl Field {
491 pub fn alias(&self) -> Option<Alias> {
492 support::child(&self.syntax)
493 }
494 pub fn name(&self) -> Option<Name> {
495 support::child(&self.syntax)
496 }
497 pub fn arguments(&self) -> Option<Arguments> {
498 support::child(&self.syntax)
499 }
500 pub fn directives(&self) -> Option<Directives> {
501 support::child(&self.syntax)
502 }
503 pub fn selection_set(&self) -> Option<SelectionSet> {
504 support::child(&self.syntax)
505 }
506}
507#[derive(Debug, Clone, PartialEq, Eq, Hash)]
508pub struct FragmentSpread {
509 pub(crate) syntax: SyntaxNode,
510}
511impl FragmentSpread {
512 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {
513 support::token(&self.syntax, S![...])
514 }
515 pub fn fragment_name(&self) -> Option<FragmentName> {
516 support::child(&self.syntax)
517 }
518 pub fn directives(&self) -> Option<Directives> {
519 support::child(&self.syntax)
520 }
521}
522#[derive(Debug, Clone, PartialEq, Eq, Hash)]
523pub struct InlineFragment {
524 pub(crate) syntax: SyntaxNode,
525}
526impl InlineFragment {
527 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {
528 support::token(&self.syntax, S![...])
529 }
530 pub fn type_condition(&self) -> Option<TypeCondition> {
531 support::child(&self.syntax)
532 }
533 pub fn directives(&self) -> Option<Directives> {
534 support::child(&self.syntax)
535 }
536 pub fn selection_set(&self) -> Option<SelectionSet> {
537 support::child(&self.syntax)
538 }
539}
540#[derive(Debug, Clone, PartialEq, Eq, Hash)]
541pub struct Alias {
542 pub(crate) syntax: SyntaxNode,
543}
544impl Alias {
545 pub fn name(&self) -> Option<Name> {
546 support::child(&self.syntax)
547 }
548 pub fn colon_token(&self) -> Option<SyntaxToken> {
549 support::token(&self.syntax, S![:])
550 }
551}
552#[derive(Debug, Clone, PartialEq, Eq, Hash)]
553pub struct Arguments {
554 pub(crate) syntax: SyntaxNode,
555}
556impl Arguments {
557 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
558 support::token(&self.syntax, S!['('])
559 }
560 pub fn arguments(&self) -> CstChildren<Argument> {
561 support::children(&self.syntax)
562 }
563 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
564 support::token(&self.syntax, S![')'])
565 }
566}
567#[derive(Debug, Clone, PartialEq, Eq, Hash)]
568pub struct Argument {
569 pub(crate) syntax: SyntaxNode,
570}
571impl Argument {
572 pub fn name(&self) -> Option<Name> {
573 support::child(&self.syntax)
574 }
575 pub fn colon_token(&self) -> Option<SyntaxToken> {
576 support::token(&self.syntax, S![:])
577 }
578 pub fn value(&self) -> Option<Value> {
579 support::child(&self.syntax)
580 }
581}
582#[derive(Debug, Clone, PartialEq, Eq, Hash)]
583pub struct FragmentName {
584 pub(crate) syntax: SyntaxNode,
585}
586impl FragmentName {
587 pub fn name(&self) -> Option<Name> {
588 support::child(&self.syntax)
589 }
590}
591#[derive(Debug, Clone, PartialEq, Eq, Hash)]
592pub struct TypeCondition {
593 pub(crate) syntax: SyntaxNode,
594}
595impl TypeCondition {
596 pub fn on_token(&self) -> Option<SyntaxToken> {
597 support::token(&self.syntax, S![on])
598 }
599 pub fn named_type(&self) -> Option<NamedType> {
600 support::child(&self.syntax)
601 }
602}
603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
604pub struct NamedType {
605 pub(crate) syntax: SyntaxNode,
606}
607impl NamedType {
608 pub fn name(&self) -> Option<Name> {
609 support::child(&self.syntax)
610 }
611}
612#[derive(Debug, Clone, PartialEq, Eq, Hash)]
613pub struct Variable {
614 pub(crate) syntax: SyntaxNode,
615}
616impl Variable {
617 pub fn dollar_token(&self) -> Option<SyntaxToken> {
618 support::token(&self.syntax, S![$])
619 }
620 pub fn name(&self) -> Option<Name> {
621 support::child(&self.syntax)
622 }
623}
624#[derive(Debug, Clone, PartialEq, Eq, Hash)]
625pub struct StringValue {
626 pub(crate) syntax: SyntaxNode,
627}
628impl StringValue {}
629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
630pub struct FloatValue {
631 pub(crate) syntax: SyntaxNode,
632}
633impl FloatValue {
634 pub fn float_token(&self) -> Option<SyntaxToken> {
635 support::token(&self.syntax, S![float])
636 }
637}
638#[derive(Debug, Clone, PartialEq, Eq, Hash)]
639pub struct IntValue {
640 pub(crate) syntax: SyntaxNode,
641}
642impl IntValue {
643 pub fn int_token(&self) -> Option<SyntaxToken> {
644 support::token(&self.syntax, S![int])
645 }
646}
647#[derive(Debug, Clone, PartialEq, Eq, Hash)]
648pub struct BooleanValue {
649 pub(crate) syntax: SyntaxNode,
650}
651impl BooleanValue {
652 pub fn true_token(&self) -> Option<SyntaxToken> {
653 support::token(&self.syntax, S![true])
654 }
655 pub fn false_token(&self) -> Option<SyntaxToken> {
656 support::token(&self.syntax, S![false])
657 }
658}
659#[derive(Debug, Clone, PartialEq, Eq, Hash)]
660pub struct NullValue {
661 pub(crate) syntax: SyntaxNode,
662}
663impl NullValue {
664 pub fn null_token(&self) -> Option<SyntaxToken> {
665 support::token(&self.syntax, S![null])
666 }
667}
668#[derive(Debug, Clone, PartialEq, Eq, Hash)]
669pub struct EnumValue {
670 pub(crate) syntax: SyntaxNode,
671}
672impl EnumValue {
673 pub fn name(&self) -> Option<Name> {
674 support::child(&self.syntax)
675 }
676}
677#[derive(Debug, Clone, PartialEq, Eq, Hash)]
678pub struct ListValue {
679 pub(crate) syntax: SyntaxNode,
680}
681impl ListValue {
682 pub fn l_brack_token(&self) -> Option<SyntaxToken> {
683 support::token(&self.syntax, S!['['])
684 }
685 pub fn r_brack_token(&self) -> Option<SyntaxToken> {
686 support::token(&self.syntax, S![']'])
687 }
688 pub fn values(&self) -> CstChildren<Value> {
689 support::children(&self.syntax)
690 }
691}
692#[derive(Debug, Clone, PartialEq, Eq, Hash)]
693pub struct ObjectValue {
694 pub(crate) syntax: SyntaxNode,
695}
696impl ObjectValue {
697 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
698 support::token(&self.syntax, S!['{'])
699 }
700 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
701 support::token(&self.syntax, S!['}'])
702 }
703 pub fn object_fields(&self) -> CstChildren<ObjectField> {
704 support::children(&self.syntax)
705 }
706}
707#[derive(Debug, Clone, PartialEq, Eq, Hash)]
708pub struct ObjectField {
709 pub(crate) syntax: SyntaxNode,
710}
711impl ObjectField {
712 pub fn name(&self) -> Option<Name> {
713 support::child(&self.syntax)
714 }
715 pub fn colon_token(&self) -> Option<SyntaxToken> {
716 support::token(&self.syntax, S![:])
717 }
718 pub fn value(&self) -> Option<Value> {
719 support::child(&self.syntax)
720 }
721}
722#[derive(Debug, Clone, PartialEq, Eq, Hash)]
723pub struct VariableDefinition {
724 pub(crate) syntax: SyntaxNode,
725}
726impl VariableDefinition {
727 pub fn variable(&self) -> Option<Variable> {
728 support::child(&self.syntax)
729 }
730 pub fn colon_token(&self) -> Option<SyntaxToken> {
731 support::token(&self.syntax, S![:])
732 }
733 pub fn ty(&self) -> Option<Type> {
734 support::child(&self.syntax)
735 }
736 pub fn default_value(&self) -> Option<DefaultValue> {
737 support::child(&self.syntax)
738 }
739 pub fn directives(&self) -> Option<Directives> {
740 support::child(&self.syntax)
741 }
742}
743#[derive(Debug, Clone, PartialEq, Eq, Hash)]
744pub struct DefaultValue {
745 pub(crate) syntax: SyntaxNode,
746}
747impl DefaultValue {
748 pub fn eq_token(&self) -> Option<SyntaxToken> {
749 support::token(&self.syntax, S![=])
750 }
751 pub fn value(&self) -> Option<Value> {
752 support::child(&self.syntax)
753 }
754}
755#[derive(Debug, Clone, PartialEq, Eq, Hash)]
756pub struct ListType {
757 pub(crate) syntax: SyntaxNode,
758}
759impl ListType {
760 pub fn l_brack_token(&self) -> Option<SyntaxToken> {
761 support::token(&self.syntax, S!['['])
762 }
763 pub fn ty(&self) -> Option<Type> {
764 support::child(&self.syntax)
765 }
766 pub fn r_brack_token(&self) -> Option<SyntaxToken> {
767 support::token(&self.syntax, S![']'])
768 }
769}
770#[derive(Debug, Clone, PartialEq, Eq, Hash)]
771pub struct NonNullType {
772 pub(crate) syntax: SyntaxNode,
773}
774impl NonNullType {
775 pub fn named_type(&self) -> Option<NamedType> {
776 support::child(&self.syntax)
777 }
778 pub fn excl_token(&self) -> Option<SyntaxToken> {
779 support::token(&self.syntax, S![!])
780 }
781 pub fn list_type(&self) -> Option<ListType> {
782 support::child(&self.syntax)
783 }
784}
785#[derive(Debug, Clone, PartialEq, Eq, Hash)]
786pub struct Directive {
787 pub(crate) syntax: SyntaxNode,
788}
789impl Directive {
790 pub fn at_token(&self) -> Option<SyntaxToken> {
791 support::token(&self.syntax, S![@])
792 }
793 pub fn name(&self) -> Option<Name> {
794 support::child(&self.syntax)
795 }
796 pub fn arguments(&self) -> Option<Arguments> {
797 support::child(&self.syntax)
798 }
799}
800#[derive(Debug, Clone, PartialEq, Eq, Hash)]
801pub struct Description {
802 pub(crate) syntax: SyntaxNode,
803}
804impl Description {
805 pub fn string_value(&self) -> Option<StringValue> {
806 support::child(&self.syntax)
807 }
808}
809#[derive(Debug, Clone, PartialEq, Eq, Hash)]
810pub struct RootOperationTypeDefinition {
811 pub(crate) syntax: SyntaxNode,
812}
813impl RootOperationTypeDefinition {
814 pub fn operation_type(&self) -> Option<OperationType> {
815 support::child(&self.syntax)
816 }
817 pub fn colon_token(&self) -> Option<SyntaxToken> {
818 support::token(&self.syntax, S![:])
819 }
820 pub fn named_type(&self) -> Option<NamedType> {
821 support::child(&self.syntax)
822 }
823}
824#[derive(Debug, Clone, PartialEq, Eq, Hash)]
825pub struct ImplementsInterfaces {
826 pub(crate) syntax: SyntaxNode,
827}
828impl ImplementsInterfaces {
829 pub fn implements_token(&self) -> Option<SyntaxToken> {
830 support::token(&self.syntax, S![implements])
831 }
832 pub fn amp_token(&self) -> Option<SyntaxToken> {
833 support::token(&self.syntax, S![&])
834 }
835 pub fn named_types(&self) -> CstChildren<NamedType> {
836 support::children(&self.syntax)
837 }
838}
839#[derive(Debug, Clone, PartialEq, Eq, Hash)]
840pub struct FieldsDefinition {
841 pub(crate) syntax: SyntaxNode,
842}
843impl FieldsDefinition {
844 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
845 support::token(&self.syntax, S!['{'])
846 }
847 pub fn field_definitions(&self) -> CstChildren<FieldDefinition> {
848 support::children(&self.syntax)
849 }
850 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
851 support::token(&self.syntax, S!['}'])
852 }
853}
854#[derive(Debug, Clone, PartialEq, Eq, Hash)]
855pub struct FieldDefinition {
856 pub(crate) syntax: SyntaxNode,
857}
858impl FieldDefinition {
859 pub fn description(&self) -> Option<Description> {
860 support::child(&self.syntax)
861 }
862 pub fn name(&self) -> Option<Name> {
863 support::child(&self.syntax)
864 }
865 pub fn arguments_definition(&self) -> Option<ArgumentsDefinition> {
866 support::child(&self.syntax)
867 }
868 pub fn colon_token(&self) -> Option<SyntaxToken> {
869 support::token(&self.syntax, S![:])
870 }
871 pub fn ty(&self) -> Option<Type> {
872 support::child(&self.syntax)
873 }
874 pub fn directives(&self) -> Option<Directives> {
875 support::child(&self.syntax)
876 }
877}
878#[derive(Debug, Clone, PartialEq, Eq, Hash)]
879pub struct ArgumentsDefinition {
880 pub(crate) syntax: SyntaxNode,
881}
882impl ArgumentsDefinition {
883 pub fn l_paren_token(&self) -> Option<SyntaxToken> {
884 support::token(&self.syntax, S!['('])
885 }
886 pub fn input_value_definitions(&self) -> CstChildren<InputValueDefinition> {
887 support::children(&self.syntax)
888 }
889 pub fn r_paren_token(&self) -> Option<SyntaxToken> {
890 support::token(&self.syntax, S![')'])
891 }
892}
893#[derive(Debug, Clone, PartialEq, Eq, Hash)]
894pub struct InputValueDefinition {
895 pub(crate) syntax: SyntaxNode,
896}
897impl InputValueDefinition {
898 pub fn description(&self) -> Option<Description> {
899 support::child(&self.syntax)
900 }
901 pub fn name(&self) -> Option<Name> {
902 support::child(&self.syntax)
903 }
904 pub fn colon_token(&self) -> Option<SyntaxToken> {
905 support::token(&self.syntax, S![:])
906 }
907 pub fn ty(&self) -> Option<Type> {
908 support::child(&self.syntax)
909 }
910 pub fn default_value(&self) -> Option<DefaultValue> {
911 support::child(&self.syntax)
912 }
913 pub fn directives(&self) -> Option<Directives> {
914 support::child(&self.syntax)
915 }
916}
917#[derive(Debug, Clone, PartialEq, Eq, Hash)]
918pub struct UnionMemberTypes {
919 pub(crate) syntax: SyntaxNode,
920}
921impl UnionMemberTypes {
922 pub fn eq_token(&self) -> Option<SyntaxToken> {
923 support::token(&self.syntax, S![=])
924 }
925 pub fn pipe_token(&self) -> Option<SyntaxToken> {
926 support::token(&self.syntax, S![|])
927 }
928 pub fn named_types(&self) -> CstChildren<NamedType> {
929 support::children(&self.syntax)
930 }
931}
932#[derive(Debug, Clone, PartialEq, Eq, Hash)]
933pub struct EnumValuesDefinition {
934 pub(crate) syntax: SyntaxNode,
935}
936impl EnumValuesDefinition {
937 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
938 support::token(&self.syntax, S!['{'])
939 }
940 pub fn enum_value_definitions(&self) -> CstChildren<EnumValueDefinition> {
941 support::children(&self.syntax)
942 }
943 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
944 support::token(&self.syntax, S!['}'])
945 }
946}
947#[derive(Debug, Clone, PartialEq, Eq, Hash)]
948pub struct EnumValueDefinition {
949 pub(crate) syntax: SyntaxNode,
950}
951impl EnumValueDefinition {
952 pub fn description(&self) -> Option<Description> {
953 support::child(&self.syntax)
954 }
955 pub fn enum_value(&self) -> Option<EnumValue> {
956 support::child(&self.syntax)
957 }
958 pub fn directives(&self) -> Option<Directives> {
959 support::child(&self.syntax)
960 }
961}
962#[derive(Debug, Clone, PartialEq, Eq, Hash)]
963pub struct InputFieldsDefinition {
964 pub(crate) syntax: SyntaxNode,
965}
966impl InputFieldsDefinition {
967 pub fn l_curly_token(&self) -> Option<SyntaxToken> {
968 support::token(&self.syntax, S!['{'])
969 }
970 pub fn input_value_definitions(&self) -> CstChildren<InputValueDefinition> {
971 support::children(&self.syntax)
972 }
973 pub fn r_curly_token(&self) -> Option<SyntaxToken> {
974 support::token(&self.syntax, S!['}'])
975 }
976}
977#[derive(Debug, Clone, PartialEq, Eq, Hash)]
978pub struct DirectiveLocations {
979 pub(crate) syntax: SyntaxNode,
980}
981impl DirectiveLocations {
982 pub fn directive_locations(&self) -> CstChildren<DirectiveLocation> {
983 support::children(&self.syntax)
984 }
985}
986#[derive(Debug, Clone, PartialEq, Eq, Hash)]
987pub struct DirectiveLocation {
988 pub(crate) syntax: SyntaxNode,
989}
990impl DirectiveLocation {
991 pub fn query_token(&self) -> Option<SyntaxToken> {
992 support::token(&self.syntax, S![QUERY])
993 }
994 pub fn mutation_token(&self) -> Option<SyntaxToken> {
995 support::token(&self.syntax, S![MUTATION])
996 }
997 pub fn subscription_token(&self) -> Option<SyntaxToken> {
998 support::token(&self.syntax, S![SUBSCRIPTION])
999 }
1000 pub fn field_token(&self) -> Option<SyntaxToken> {
1001 support::token(&self.syntax, S![FIELD])
1002 }
1003 pub fn fragment_definition_token(&self) -> Option<SyntaxToken> {
1004 support::token(&self.syntax, S![FRAGMENT_DEFINITION])
1005 }
1006 pub fn fragment_spread_token(&self) -> Option<SyntaxToken> {
1007 support::token(&self.syntax, S![FRAGMENT_SPREAD])
1008 }
1009 pub fn inline_fragment_token(&self) -> Option<SyntaxToken> {
1010 support::token(&self.syntax, S![INLINE_FRAGMENT])
1011 }
1012 pub fn variable_definition_token(&self) -> Option<SyntaxToken> {
1013 support::token(&self.syntax, S![VARIABLE_DEFINITION])
1014 }
1015 pub fn schema_token(&self) -> Option<SyntaxToken> {
1016 support::token(&self.syntax, S![SCHEMA])
1017 }
1018 pub fn scalar_token(&self) -> Option<SyntaxToken> {
1019 support::token(&self.syntax, S![SCALAR])
1020 }
1021 pub fn object_token(&self) -> Option<SyntaxToken> {
1022 support::token(&self.syntax, S![OBJECT])
1023 }
1024 pub fn field_definition_token(&self) -> Option<SyntaxToken> {
1025 support::token(&self.syntax, S![FIELD_DEFINITION])
1026 }
1027 pub fn argument_definition_token(&self) -> Option<SyntaxToken> {
1028 support::token(&self.syntax, S![ARGUMENT_DEFINITION])
1029 }
1030 pub fn interface_token(&self) -> Option<SyntaxToken> {
1031 support::token(&self.syntax, S![INTERFACE])
1032 }
1033 pub fn union_token(&self) -> Option<SyntaxToken> {
1034 support::token(&self.syntax, S![UNION])
1035 }
1036 pub fn enum_token(&self) -> Option<SyntaxToken> {
1037 support::token(&self.syntax, S![ENUM])
1038 }
1039 pub fn enum_value_token(&self) -> Option<SyntaxToken> {
1040 support::token(&self.syntax, S![ENUM_VALUE])
1041 }
1042 pub fn input_object_token(&self) -> Option<SyntaxToken> {
1043 support::token(&self.syntax, S![INPUT_OBJECT])
1044 }
1045 pub fn input_field_definition_token(&self) -> Option<SyntaxToken> {
1046 support::token(&self.syntax, S![INPUT_FIELD_DEFINITION])
1047 }
1048}
1049#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1050pub enum Definition {
1051 OperationDefinition(OperationDefinition),
1052 FragmentDefinition(FragmentDefinition),
1053 DirectiveDefinition(DirectiveDefinition),
1054 SchemaDefinition(SchemaDefinition),
1055 ScalarTypeDefinition(ScalarTypeDefinition),
1056 ObjectTypeDefinition(ObjectTypeDefinition),
1057 InterfaceTypeDefinition(InterfaceTypeDefinition),
1058 UnionTypeDefinition(UnionTypeDefinition),
1059 EnumTypeDefinition(EnumTypeDefinition),
1060 InputObjectTypeDefinition(InputObjectTypeDefinition),
1061 SchemaExtension(SchemaExtension),
1062 DirectiveExtension(DirectiveExtension),
1063 ScalarTypeExtension(ScalarTypeExtension),
1064 ObjectTypeExtension(ObjectTypeExtension),
1065 InterfaceTypeExtension(InterfaceTypeExtension),
1066 UnionTypeExtension(UnionTypeExtension),
1067 EnumTypeExtension(EnumTypeExtension),
1068 InputObjectTypeExtension(InputObjectTypeExtension),
1069}
1070#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1071pub enum Selection {
1072 Field(Field),
1073 FragmentSpread(FragmentSpread),
1074 InlineFragment(InlineFragment),
1075}
1076#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1077pub enum Value {
1078 Variable(Variable),
1079 StringValue(StringValue),
1080 FloatValue(FloatValue),
1081 IntValue(IntValue),
1082 BooleanValue(BooleanValue),
1083 NullValue(NullValue),
1084 EnumValue(EnumValue),
1085 ListValue(ListValue),
1086 ObjectValue(ObjectValue),
1087}
1088#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1089pub enum Type {
1090 NamedType(NamedType),
1091 ListType(ListType),
1092 NonNullType(NonNullType),
1093}
1094impl CstNode for Name {
1095 fn can_cast(kind: SyntaxKind) -> bool {
1096 kind == NAME
1097 }
1098 fn cast(syntax: SyntaxNode) -> Option<Self> {
1099 if Self::can_cast(syntax.kind()) {
1100 Some(Self { syntax })
1101 } else {
1102 None
1103 }
1104 }
1105 fn syntax(&self) -> &SyntaxNode {
1106 &self.syntax
1107 }
1108}
1109impl CstNode for Document {
1110 fn can_cast(kind: SyntaxKind) -> bool {
1111 kind == DOCUMENT
1112 }
1113 fn cast(syntax: SyntaxNode) -> Option<Self> {
1114 if Self::can_cast(syntax.kind()) {
1115 Some(Self { syntax })
1116 } else {
1117 None
1118 }
1119 }
1120 fn syntax(&self) -> &SyntaxNode {
1121 &self.syntax
1122 }
1123}
1124impl CstNode for OperationDefinition {
1125 fn can_cast(kind: SyntaxKind) -> bool {
1126 kind == OPERATION_DEFINITION
1127 }
1128 fn cast(syntax: SyntaxNode) -> Option<Self> {
1129 if Self::can_cast(syntax.kind()) {
1130 Some(Self { syntax })
1131 } else {
1132 None
1133 }
1134 }
1135 fn syntax(&self) -> &SyntaxNode {
1136 &self.syntax
1137 }
1138}
1139impl CstNode for FragmentDefinition {
1140 fn can_cast(kind: SyntaxKind) -> bool {
1141 kind == FRAGMENT_DEFINITION
1142 }
1143 fn cast(syntax: SyntaxNode) -> Option<Self> {
1144 if Self::can_cast(syntax.kind()) {
1145 Some(Self { syntax })
1146 } else {
1147 None
1148 }
1149 }
1150 fn syntax(&self) -> &SyntaxNode {
1151 &self.syntax
1152 }
1153}
1154impl CstNode for DirectiveDefinition {
1155 fn can_cast(kind: SyntaxKind) -> bool {
1156 kind == DIRECTIVE_DEFINITION
1157 }
1158 fn cast(syntax: SyntaxNode) -> Option<Self> {
1159 if Self::can_cast(syntax.kind()) {
1160 Some(Self { syntax })
1161 } else {
1162 None
1163 }
1164 }
1165 fn syntax(&self) -> &SyntaxNode {
1166 &self.syntax
1167 }
1168}
1169impl CstNode for SchemaDefinition {
1170 fn can_cast(kind: SyntaxKind) -> bool {
1171 kind == SCHEMA_DEFINITION
1172 }
1173 fn cast(syntax: SyntaxNode) -> Option<Self> {
1174 if Self::can_cast(syntax.kind()) {
1175 Some(Self { syntax })
1176 } else {
1177 None
1178 }
1179 }
1180 fn syntax(&self) -> &SyntaxNode {
1181 &self.syntax
1182 }
1183}
1184impl CstNode for ScalarTypeDefinition {
1185 fn can_cast(kind: SyntaxKind) -> bool {
1186 kind == SCALAR_TYPE_DEFINITION
1187 }
1188 fn cast(syntax: SyntaxNode) -> Option<Self> {
1189 if Self::can_cast(syntax.kind()) {
1190 Some(Self { syntax })
1191 } else {
1192 None
1193 }
1194 }
1195 fn syntax(&self) -> &SyntaxNode {
1196 &self.syntax
1197 }
1198}
1199impl CstNode for ObjectTypeDefinition {
1200 fn can_cast(kind: SyntaxKind) -> bool {
1201 kind == OBJECT_TYPE_DEFINITION
1202 }
1203 fn cast(syntax: SyntaxNode) -> Option<Self> {
1204 if Self::can_cast(syntax.kind()) {
1205 Some(Self { syntax })
1206 } else {
1207 None
1208 }
1209 }
1210 fn syntax(&self) -> &SyntaxNode {
1211 &self.syntax
1212 }
1213}
1214impl CstNode for InterfaceTypeDefinition {
1215 fn can_cast(kind: SyntaxKind) -> bool {
1216 kind == INTERFACE_TYPE_DEFINITION
1217 }
1218 fn cast(syntax: SyntaxNode) -> Option<Self> {
1219 if Self::can_cast(syntax.kind()) {
1220 Some(Self { syntax })
1221 } else {
1222 None
1223 }
1224 }
1225 fn syntax(&self) -> &SyntaxNode {
1226 &self.syntax
1227 }
1228}
1229impl CstNode for UnionTypeDefinition {
1230 fn can_cast(kind: SyntaxKind) -> bool {
1231 kind == UNION_TYPE_DEFINITION
1232 }
1233 fn cast(syntax: SyntaxNode) -> Option<Self> {
1234 if Self::can_cast(syntax.kind()) {
1235 Some(Self { syntax })
1236 } else {
1237 None
1238 }
1239 }
1240 fn syntax(&self) -> &SyntaxNode {
1241 &self.syntax
1242 }
1243}
1244impl CstNode for EnumTypeDefinition {
1245 fn can_cast(kind: SyntaxKind) -> bool {
1246 kind == ENUM_TYPE_DEFINITION
1247 }
1248 fn cast(syntax: SyntaxNode) -> Option<Self> {
1249 if Self::can_cast(syntax.kind()) {
1250 Some(Self { syntax })
1251 } else {
1252 None
1253 }
1254 }
1255 fn syntax(&self) -> &SyntaxNode {
1256 &self.syntax
1257 }
1258}
1259impl CstNode for InputObjectTypeDefinition {
1260 fn can_cast(kind: SyntaxKind) -> bool {
1261 kind == INPUT_OBJECT_TYPE_DEFINITION
1262 }
1263 fn cast(syntax: SyntaxNode) -> Option<Self> {
1264 if Self::can_cast(syntax.kind()) {
1265 Some(Self { syntax })
1266 } else {
1267 None
1268 }
1269 }
1270 fn syntax(&self) -> &SyntaxNode {
1271 &self.syntax
1272 }
1273}
1274impl CstNode for SchemaExtension {
1275 fn can_cast(kind: SyntaxKind) -> bool {
1276 kind == SCHEMA_EXTENSION
1277 }
1278 fn cast(syntax: SyntaxNode) -> Option<Self> {
1279 if Self::can_cast(syntax.kind()) {
1280 Some(Self { syntax })
1281 } else {
1282 None
1283 }
1284 }
1285 fn syntax(&self) -> &SyntaxNode {
1286 &self.syntax
1287 }
1288}
1289impl CstNode for DirectiveExtension {
1290 fn can_cast(kind: SyntaxKind) -> bool {
1291 kind == DIRECTIVE_EXTENSION
1292 }
1293 fn cast(syntax: SyntaxNode) -> Option<Self> {
1294 if Self::can_cast(syntax.kind()) {
1295 Some(Self { syntax })
1296 } else {
1297 None
1298 }
1299 }
1300 fn syntax(&self) -> &SyntaxNode {
1301 &self.syntax
1302 }
1303}
1304impl CstNode for ScalarTypeExtension {
1305 fn can_cast(kind: SyntaxKind) -> bool {
1306 kind == SCALAR_TYPE_EXTENSION
1307 }
1308 fn cast(syntax: SyntaxNode) -> Option<Self> {
1309 if Self::can_cast(syntax.kind()) {
1310 Some(Self { syntax })
1311 } else {
1312 None
1313 }
1314 }
1315 fn syntax(&self) -> &SyntaxNode {
1316 &self.syntax
1317 }
1318}
1319impl CstNode for ObjectTypeExtension {
1320 fn can_cast(kind: SyntaxKind) -> bool {
1321 kind == OBJECT_TYPE_EXTENSION
1322 }
1323 fn cast(syntax: SyntaxNode) -> Option<Self> {
1324 if Self::can_cast(syntax.kind()) {
1325 Some(Self { syntax })
1326 } else {
1327 None
1328 }
1329 }
1330 fn syntax(&self) -> &SyntaxNode {
1331 &self.syntax
1332 }
1333}
1334impl CstNode for InterfaceTypeExtension {
1335 fn can_cast(kind: SyntaxKind) -> bool {
1336 kind == INTERFACE_TYPE_EXTENSION
1337 }
1338 fn cast(syntax: SyntaxNode) -> Option<Self> {
1339 if Self::can_cast(syntax.kind()) {
1340 Some(Self { syntax })
1341 } else {
1342 None
1343 }
1344 }
1345 fn syntax(&self) -> &SyntaxNode {
1346 &self.syntax
1347 }
1348}
1349impl CstNode for UnionTypeExtension {
1350 fn can_cast(kind: SyntaxKind) -> bool {
1351 kind == UNION_TYPE_EXTENSION
1352 }
1353 fn cast(syntax: SyntaxNode) -> Option<Self> {
1354 if Self::can_cast(syntax.kind()) {
1355 Some(Self { syntax })
1356 } else {
1357 None
1358 }
1359 }
1360 fn syntax(&self) -> &SyntaxNode {
1361 &self.syntax
1362 }
1363}
1364impl CstNode for EnumTypeExtension {
1365 fn can_cast(kind: SyntaxKind) -> bool {
1366 kind == ENUM_TYPE_EXTENSION
1367 }
1368 fn cast(syntax: SyntaxNode) -> Option<Self> {
1369 if Self::can_cast(syntax.kind()) {
1370 Some(Self { syntax })
1371 } else {
1372 None
1373 }
1374 }
1375 fn syntax(&self) -> &SyntaxNode {
1376 &self.syntax
1377 }
1378}
1379impl CstNode for InputObjectTypeExtension {
1380 fn can_cast(kind: SyntaxKind) -> bool {
1381 kind == INPUT_OBJECT_TYPE_EXTENSION
1382 }
1383 fn cast(syntax: SyntaxNode) -> Option<Self> {
1384 if Self::can_cast(syntax.kind()) {
1385 Some(Self { syntax })
1386 } else {
1387 None
1388 }
1389 }
1390 fn syntax(&self) -> &SyntaxNode {
1391 &self.syntax
1392 }
1393}
1394impl CstNode for OperationType {
1395 fn can_cast(kind: SyntaxKind) -> bool {
1396 kind == OPERATION_TYPE
1397 }
1398 fn cast(syntax: SyntaxNode) -> Option<Self> {
1399 if Self::can_cast(syntax.kind()) {
1400 Some(Self { syntax })
1401 } else {
1402 None
1403 }
1404 }
1405 fn syntax(&self) -> &SyntaxNode {
1406 &self.syntax
1407 }
1408}
1409impl CstNode for VariableDefinitions {
1410 fn can_cast(kind: SyntaxKind) -> bool {
1411 kind == VARIABLE_DEFINITIONS
1412 }
1413 fn cast(syntax: SyntaxNode) -> Option<Self> {
1414 if Self::can_cast(syntax.kind()) {
1415 Some(Self { syntax })
1416 } else {
1417 None
1418 }
1419 }
1420 fn syntax(&self) -> &SyntaxNode {
1421 &self.syntax
1422 }
1423}
1424impl CstNode for Directives {
1425 fn can_cast(kind: SyntaxKind) -> bool {
1426 kind == DIRECTIVES
1427 }
1428 fn cast(syntax: SyntaxNode) -> Option<Self> {
1429 if Self::can_cast(syntax.kind()) {
1430 Some(Self { syntax })
1431 } else {
1432 None
1433 }
1434 }
1435 fn syntax(&self) -> &SyntaxNode {
1436 &self.syntax
1437 }
1438}
1439impl CstNode for SelectionSet {
1440 fn can_cast(kind: SyntaxKind) -> bool {
1441 kind == SELECTION_SET
1442 }
1443 fn cast(syntax: SyntaxNode) -> Option<Self> {
1444 if Self::can_cast(syntax.kind()) {
1445 Some(Self { syntax })
1446 } else {
1447 None
1448 }
1449 }
1450 fn syntax(&self) -> &SyntaxNode {
1451 &self.syntax
1452 }
1453}
1454impl CstNode for Field {
1455 fn can_cast(kind: SyntaxKind) -> bool {
1456 kind == FIELD
1457 }
1458 fn cast(syntax: SyntaxNode) -> Option<Self> {
1459 if Self::can_cast(syntax.kind()) {
1460 Some(Self { syntax })
1461 } else {
1462 None
1463 }
1464 }
1465 fn syntax(&self) -> &SyntaxNode {
1466 &self.syntax
1467 }
1468}
1469impl CstNode for FragmentSpread {
1470 fn can_cast(kind: SyntaxKind) -> bool {
1471 kind == FRAGMENT_SPREAD
1472 }
1473 fn cast(syntax: SyntaxNode) -> Option<Self> {
1474 if Self::can_cast(syntax.kind()) {
1475 Some(Self { syntax })
1476 } else {
1477 None
1478 }
1479 }
1480 fn syntax(&self) -> &SyntaxNode {
1481 &self.syntax
1482 }
1483}
1484impl CstNode for InlineFragment {
1485 fn can_cast(kind: SyntaxKind) -> bool {
1486 kind == INLINE_FRAGMENT
1487 }
1488 fn cast(syntax: SyntaxNode) -> Option<Self> {
1489 if Self::can_cast(syntax.kind()) {
1490 Some(Self { syntax })
1491 } else {
1492 None
1493 }
1494 }
1495 fn syntax(&self) -> &SyntaxNode {
1496 &self.syntax
1497 }
1498}
1499impl CstNode for Alias {
1500 fn can_cast(kind: SyntaxKind) -> bool {
1501 kind == ALIAS
1502 }
1503 fn cast(syntax: SyntaxNode) -> Option<Self> {
1504 if Self::can_cast(syntax.kind()) {
1505 Some(Self { syntax })
1506 } else {
1507 None
1508 }
1509 }
1510 fn syntax(&self) -> &SyntaxNode {
1511 &self.syntax
1512 }
1513}
1514impl CstNode for Arguments {
1515 fn can_cast(kind: SyntaxKind) -> bool {
1516 kind == ARGUMENTS
1517 }
1518 fn cast(syntax: SyntaxNode) -> Option<Self> {
1519 if Self::can_cast(syntax.kind()) {
1520 Some(Self { syntax })
1521 } else {
1522 None
1523 }
1524 }
1525 fn syntax(&self) -> &SyntaxNode {
1526 &self.syntax
1527 }
1528}
1529impl CstNode for Argument {
1530 fn can_cast(kind: SyntaxKind) -> bool {
1531 kind == ARGUMENT
1532 }
1533 fn cast(syntax: SyntaxNode) -> Option<Self> {
1534 if Self::can_cast(syntax.kind()) {
1535 Some(Self { syntax })
1536 } else {
1537 None
1538 }
1539 }
1540 fn syntax(&self) -> &SyntaxNode {
1541 &self.syntax
1542 }
1543}
1544impl CstNode for FragmentName {
1545 fn can_cast(kind: SyntaxKind) -> bool {
1546 kind == FRAGMENT_NAME
1547 }
1548 fn cast(syntax: SyntaxNode) -> Option<Self> {
1549 if Self::can_cast(syntax.kind()) {
1550 Some(Self { syntax })
1551 } else {
1552 None
1553 }
1554 }
1555 fn syntax(&self) -> &SyntaxNode {
1556 &self.syntax
1557 }
1558}
1559impl CstNode for TypeCondition {
1560 fn can_cast(kind: SyntaxKind) -> bool {
1561 kind == TYPE_CONDITION
1562 }
1563 fn cast(syntax: SyntaxNode) -> Option<Self> {
1564 if Self::can_cast(syntax.kind()) {
1565 Some(Self { syntax })
1566 } else {
1567 None
1568 }
1569 }
1570 fn syntax(&self) -> &SyntaxNode {
1571 &self.syntax
1572 }
1573}
1574impl CstNode for NamedType {
1575 fn can_cast(kind: SyntaxKind) -> bool {
1576 kind == NAMED_TYPE
1577 }
1578 fn cast(syntax: SyntaxNode) -> Option<Self> {
1579 if Self::can_cast(syntax.kind()) {
1580 Some(Self { syntax })
1581 } else {
1582 None
1583 }
1584 }
1585 fn syntax(&self) -> &SyntaxNode {
1586 &self.syntax
1587 }
1588}
1589impl CstNode for Variable {
1590 fn can_cast(kind: SyntaxKind) -> bool {
1591 kind == VARIABLE
1592 }
1593 fn cast(syntax: SyntaxNode) -> Option<Self> {
1594 if Self::can_cast(syntax.kind()) {
1595 Some(Self { syntax })
1596 } else {
1597 None
1598 }
1599 }
1600 fn syntax(&self) -> &SyntaxNode {
1601 &self.syntax
1602 }
1603}
1604impl CstNode for StringValue {
1605 fn can_cast(kind: SyntaxKind) -> bool {
1606 kind == STRING_VALUE
1607 }
1608 fn cast(syntax: SyntaxNode) -> Option<Self> {
1609 if Self::can_cast(syntax.kind()) {
1610 Some(Self { syntax })
1611 } else {
1612 None
1613 }
1614 }
1615 fn syntax(&self) -> &SyntaxNode {
1616 &self.syntax
1617 }
1618}
1619impl CstNode for FloatValue {
1620 fn can_cast(kind: SyntaxKind) -> bool {
1621 kind == FLOAT_VALUE
1622 }
1623 fn cast(syntax: SyntaxNode) -> Option<Self> {
1624 if Self::can_cast(syntax.kind()) {
1625 Some(Self { syntax })
1626 } else {
1627 None
1628 }
1629 }
1630 fn syntax(&self) -> &SyntaxNode {
1631 &self.syntax
1632 }
1633}
1634impl CstNode for IntValue {
1635 fn can_cast(kind: SyntaxKind) -> bool {
1636 kind == INT_VALUE
1637 }
1638 fn cast(syntax: SyntaxNode) -> Option<Self> {
1639 if Self::can_cast(syntax.kind()) {
1640 Some(Self { syntax })
1641 } else {
1642 None
1643 }
1644 }
1645 fn syntax(&self) -> &SyntaxNode {
1646 &self.syntax
1647 }
1648}
1649impl CstNode for BooleanValue {
1650 fn can_cast(kind: SyntaxKind) -> bool {
1651 kind == BOOLEAN_VALUE
1652 }
1653 fn cast(syntax: SyntaxNode) -> Option<Self> {
1654 if Self::can_cast(syntax.kind()) {
1655 Some(Self { syntax })
1656 } else {
1657 None
1658 }
1659 }
1660 fn syntax(&self) -> &SyntaxNode {
1661 &self.syntax
1662 }
1663}
1664impl CstNode for NullValue {
1665 fn can_cast(kind: SyntaxKind) -> bool {
1666 kind == NULL_VALUE
1667 }
1668 fn cast(syntax: SyntaxNode) -> Option<Self> {
1669 if Self::can_cast(syntax.kind()) {
1670 Some(Self { syntax })
1671 } else {
1672 None
1673 }
1674 }
1675 fn syntax(&self) -> &SyntaxNode {
1676 &self.syntax
1677 }
1678}
1679impl CstNode for EnumValue {
1680 fn can_cast(kind: SyntaxKind) -> bool {
1681 kind == ENUM_VALUE
1682 }
1683 fn cast(syntax: SyntaxNode) -> Option<Self> {
1684 if Self::can_cast(syntax.kind()) {
1685 Some(Self { syntax })
1686 } else {
1687 None
1688 }
1689 }
1690 fn syntax(&self) -> &SyntaxNode {
1691 &self.syntax
1692 }
1693}
1694impl CstNode for ListValue {
1695 fn can_cast(kind: SyntaxKind) -> bool {
1696 kind == LIST_VALUE
1697 }
1698 fn cast(syntax: SyntaxNode) -> Option<Self> {
1699 if Self::can_cast(syntax.kind()) {
1700 Some(Self { syntax })
1701 } else {
1702 None
1703 }
1704 }
1705 fn syntax(&self) -> &SyntaxNode {
1706 &self.syntax
1707 }
1708}
1709impl CstNode for ObjectValue {
1710 fn can_cast(kind: SyntaxKind) -> bool {
1711 kind == OBJECT_VALUE
1712 }
1713 fn cast(syntax: SyntaxNode) -> Option<Self> {
1714 if Self::can_cast(syntax.kind()) {
1715 Some(Self { syntax })
1716 } else {
1717 None
1718 }
1719 }
1720 fn syntax(&self) -> &SyntaxNode {
1721 &self.syntax
1722 }
1723}
1724impl CstNode for ObjectField {
1725 fn can_cast(kind: SyntaxKind) -> bool {
1726 kind == OBJECT_FIELD
1727 }
1728 fn cast(syntax: SyntaxNode) -> Option<Self> {
1729 if Self::can_cast(syntax.kind()) {
1730 Some(Self { syntax })
1731 } else {
1732 None
1733 }
1734 }
1735 fn syntax(&self) -> &SyntaxNode {
1736 &self.syntax
1737 }
1738}
1739impl CstNode for VariableDefinition {
1740 fn can_cast(kind: SyntaxKind) -> bool {
1741 kind == VARIABLE_DEFINITION
1742 }
1743 fn cast(syntax: SyntaxNode) -> Option<Self> {
1744 if Self::can_cast(syntax.kind()) {
1745 Some(Self { syntax })
1746 } else {
1747 None
1748 }
1749 }
1750 fn syntax(&self) -> &SyntaxNode {
1751 &self.syntax
1752 }
1753}
1754impl CstNode for DefaultValue {
1755 fn can_cast(kind: SyntaxKind) -> bool {
1756 kind == DEFAULT_VALUE
1757 }
1758 fn cast(syntax: SyntaxNode) -> Option<Self> {
1759 if Self::can_cast(syntax.kind()) {
1760 Some(Self { syntax })
1761 } else {
1762 None
1763 }
1764 }
1765 fn syntax(&self) -> &SyntaxNode {
1766 &self.syntax
1767 }
1768}
1769impl CstNode for ListType {
1770 fn can_cast(kind: SyntaxKind) -> bool {
1771 kind == LIST_TYPE
1772 }
1773 fn cast(syntax: SyntaxNode) -> Option<Self> {
1774 if Self::can_cast(syntax.kind()) {
1775 Some(Self { syntax })
1776 } else {
1777 None
1778 }
1779 }
1780 fn syntax(&self) -> &SyntaxNode {
1781 &self.syntax
1782 }
1783}
1784impl CstNode for NonNullType {
1785 fn can_cast(kind: SyntaxKind) -> bool {
1786 kind == NON_NULL_TYPE
1787 }
1788 fn cast(syntax: SyntaxNode) -> Option<Self> {
1789 if Self::can_cast(syntax.kind()) {
1790 Some(Self { syntax })
1791 } else {
1792 None
1793 }
1794 }
1795 fn syntax(&self) -> &SyntaxNode {
1796 &self.syntax
1797 }
1798}
1799impl CstNode for Directive {
1800 fn can_cast(kind: SyntaxKind) -> bool {
1801 kind == DIRECTIVE
1802 }
1803 fn cast(syntax: SyntaxNode) -> Option<Self> {
1804 if Self::can_cast(syntax.kind()) {
1805 Some(Self { syntax })
1806 } else {
1807 None
1808 }
1809 }
1810 fn syntax(&self) -> &SyntaxNode {
1811 &self.syntax
1812 }
1813}
1814impl CstNode for Description {
1815 fn can_cast(kind: SyntaxKind) -> bool {
1816 kind == DESCRIPTION
1817 }
1818 fn cast(syntax: SyntaxNode) -> Option<Self> {
1819 if Self::can_cast(syntax.kind()) {
1820 Some(Self { syntax })
1821 } else {
1822 None
1823 }
1824 }
1825 fn syntax(&self) -> &SyntaxNode {
1826 &self.syntax
1827 }
1828}
1829impl CstNode for RootOperationTypeDefinition {
1830 fn can_cast(kind: SyntaxKind) -> bool {
1831 kind == ROOT_OPERATION_TYPE_DEFINITION
1832 }
1833 fn cast(syntax: SyntaxNode) -> Option<Self> {
1834 if Self::can_cast(syntax.kind()) {
1835 Some(Self { syntax })
1836 } else {
1837 None
1838 }
1839 }
1840 fn syntax(&self) -> &SyntaxNode {
1841 &self.syntax
1842 }
1843}
1844impl CstNode for ImplementsInterfaces {
1845 fn can_cast(kind: SyntaxKind) -> bool {
1846 kind == IMPLEMENTS_INTERFACES
1847 }
1848 fn cast(syntax: SyntaxNode) -> Option<Self> {
1849 if Self::can_cast(syntax.kind()) {
1850 Some(Self { syntax })
1851 } else {
1852 None
1853 }
1854 }
1855 fn syntax(&self) -> &SyntaxNode {
1856 &self.syntax
1857 }
1858}
1859impl CstNode for FieldsDefinition {
1860 fn can_cast(kind: SyntaxKind) -> bool {
1861 kind == FIELDS_DEFINITION
1862 }
1863 fn cast(syntax: SyntaxNode) -> Option<Self> {
1864 if Self::can_cast(syntax.kind()) {
1865 Some(Self { syntax })
1866 } else {
1867 None
1868 }
1869 }
1870 fn syntax(&self) -> &SyntaxNode {
1871 &self.syntax
1872 }
1873}
1874impl CstNode for FieldDefinition {
1875 fn can_cast(kind: SyntaxKind) -> bool {
1876 kind == FIELD_DEFINITION
1877 }
1878 fn cast(syntax: SyntaxNode) -> Option<Self> {
1879 if Self::can_cast(syntax.kind()) {
1880 Some(Self { syntax })
1881 } else {
1882 None
1883 }
1884 }
1885 fn syntax(&self) -> &SyntaxNode {
1886 &self.syntax
1887 }
1888}
1889impl CstNode for ArgumentsDefinition {
1890 fn can_cast(kind: SyntaxKind) -> bool {
1891 kind == ARGUMENTS_DEFINITION
1892 }
1893 fn cast(syntax: SyntaxNode) -> Option<Self> {
1894 if Self::can_cast(syntax.kind()) {
1895 Some(Self { syntax })
1896 } else {
1897 None
1898 }
1899 }
1900 fn syntax(&self) -> &SyntaxNode {
1901 &self.syntax
1902 }
1903}
1904impl CstNode for InputValueDefinition {
1905 fn can_cast(kind: SyntaxKind) -> bool {
1906 kind == INPUT_VALUE_DEFINITION
1907 }
1908 fn cast(syntax: SyntaxNode) -> Option<Self> {
1909 if Self::can_cast(syntax.kind()) {
1910 Some(Self { syntax })
1911 } else {
1912 None
1913 }
1914 }
1915 fn syntax(&self) -> &SyntaxNode {
1916 &self.syntax
1917 }
1918}
1919impl CstNode for UnionMemberTypes {
1920 fn can_cast(kind: SyntaxKind) -> bool {
1921 kind == UNION_MEMBER_TYPES
1922 }
1923 fn cast(syntax: SyntaxNode) -> Option<Self> {
1924 if Self::can_cast(syntax.kind()) {
1925 Some(Self { syntax })
1926 } else {
1927 None
1928 }
1929 }
1930 fn syntax(&self) -> &SyntaxNode {
1931 &self.syntax
1932 }
1933}
1934impl CstNode for EnumValuesDefinition {
1935 fn can_cast(kind: SyntaxKind) -> bool {
1936 kind == ENUM_VALUES_DEFINITION
1937 }
1938 fn cast(syntax: SyntaxNode) -> Option<Self> {
1939 if Self::can_cast(syntax.kind()) {
1940 Some(Self { syntax })
1941 } else {
1942 None
1943 }
1944 }
1945 fn syntax(&self) -> &SyntaxNode {
1946 &self.syntax
1947 }
1948}
1949impl CstNode for EnumValueDefinition {
1950 fn can_cast(kind: SyntaxKind) -> bool {
1951 kind == ENUM_VALUE_DEFINITION
1952 }
1953 fn cast(syntax: SyntaxNode) -> Option<Self> {
1954 if Self::can_cast(syntax.kind()) {
1955 Some(Self { syntax })
1956 } else {
1957 None
1958 }
1959 }
1960 fn syntax(&self) -> &SyntaxNode {
1961 &self.syntax
1962 }
1963}
1964impl CstNode for InputFieldsDefinition {
1965 fn can_cast(kind: SyntaxKind) -> bool {
1966 kind == INPUT_FIELDS_DEFINITION
1967 }
1968 fn cast(syntax: SyntaxNode) -> Option<Self> {
1969 if Self::can_cast(syntax.kind()) {
1970 Some(Self { syntax })
1971 } else {
1972 None
1973 }
1974 }
1975 fn syntax(&self) -> &SyntaxNode {
1976 &self.syntax
1977 }
1978}
1979impl CstNode for DirectiveLocations {
1980 fn can_cast(kind: SyntaxKind) -> bool {
1981 kind == DIRECTIVE_LOCATIONS
1982 }
1983 fn cast(syntax: SyntaxNode) -> Option<Self> {
1984 if Self::can_cast(syntax.kind()) {
1985 Some(Self { syntax })
1986 } else {
1987 None
1988 }
1989 }
1990 fn syntax(&self) -> &SyntaxNode {
1991 &self.syntax
1992 }
1993}
1994impl CstNode for DirectiveLocation {
1995 fn can_cast(kind: SyntaxKind) -> bool {
1996 kind == DIRECTIVE_LOCATION
1997 }
1998 fn cast(syntax: SyntaxNode) -> Option<Self> {
1999 if Self::can_cast(syntax.kind()) {
2000 Some(Self { syntax })
2001 } else {
2002 None
2003 }
2004 }
2005 fn syntax(&self) -> &SyntaxNode {
2006 &self.syntax
2007 }
2008}
2009impl From<OperationDefinition> for Definition {
2010 fn from(node: OperationDefinition) -> Definition {
2011 Definition::OperationDefinition(node)
2012 }
2013}
2014impl From<FragmentDefinition> for Definition {
2015 fn from(node: FragmentDefinition) -> Definition {
2016 Definition::FragmentDefinition(node)
2017 }
2018}
2019impl From<DirectiveDefinition> for Definition {
2020 fn from(node: DirectiveDefinition) -> Definition {
2021 Definition::DirectiveDefinition(node)
2022 }
2023}
2024impl From<SchemaDefinition> for Definition {
2025 fn from(node: SchemaDefinition) -> Definition {
2026 Definition::SchemaDefinition(node)
2027 }
2028}
2029impl From<ScalarTypeDefinition> for Definition {
2030 fn from(node: ScalarTypeDefinition) -> Definition {
2031 Definition::ScalarTypeDefinition(node)
2032 }
2033}
2034impl From<ObjectTypeDefinition> for Definition {
2035 fn from(node: ObjectTypeDefinition) -> Definition {
2036 Definition::ObjectTypeDefinition(node)
2037 }
2038}
2039impl From<InterfaceTypeDefinition> for Definition {
2040 fn from(node: InterfaceTypeDefinition) -> Definition {
2041 Definition::InterfaceTypeDefinition(node)
2042 }
2043}
2044impl From<UnionTypeDefinition> for Definition {
2045 fn from(node: UnionTypeDefinition) -> Definition {
2046 Definition::UnionTypeDefinition(node)
2047 }
2048}
2049impl From<EnumTypeDefinition> for Definition {
2050 fn from(node: EnumTypeDefinition) -> Definition {
2051 Definition::EnumTypeDefinition(node)
2052 }
2053}
2054impl From<InputObjectTypeDefinition> for Definition {
2055 fn from(node: InputObjectTypeDefinition) -> Definition {
2056 Definition::InputObjectTypeDefinition(node)
2057 }
2058}
2059impl From<SchemaExtension> for Definition {
2060 fn from(node: SchemaExtension) -> Definition {
2061 Definition::SchemaExtension(node)
2062 }
2063}
2064impl From<ScalarTypeExtension> for Definition {
2065 fn from(node: ScalarTypeExtension) -> Definition {
2066 Definition::ScalarTypeExtension(node)
2067 }
2068}
2069impl From<ObjectTypeExtension> for Definition {
2070 fn from(node: ObjectTypeExtension) -> Definition {
2071 Definition::ObjectTypeExtension(node)
2072 }
2073}
2074impl From<InterfaceTypeExtension> for Definition {
2075 fn from(node: InterfaceTypeExtension) -> Definition {
2076 Definition::InterfaceTypeExtension(node)
2077 }
2078}
2079impl From<UnionTypeExtension> for Definition {
2080 fn from(node: UnionTypeExtension) -> Definition {
2081 Definition::UnionTypeExtension(node)
2082 }
2083}
2084impl From<EnumTypeExtension> for Definition {
2085 fn from(node: EnumTypeExtension) -> Definition {
2086 Definition::EnumTypeExtension(node)
2087 }
2088}
2089impl From<InputObjectTypeExtension> for Definition {
2090 fn from(node: InputObjectTypeExtension) -> Definition {
2091 Definition::InputObjectTypeExtension(node)
2092 }
2093}
2094impl From<DirectiveExtension> for Definition {
2095 fn from(node: DirectiveExtension) -> Definition {
2096 Definition::DirectiveExtension(node)
2097 }
2098}
2099impl CstNode for Definition {
2100 fn can_cast(kind: SyntaxKind) -> bool {
2101 matches!(
2102 kind,
2103 OPERATION_DEFINITION
2104 | FRAGMENT_DEFINITION
2105 | DIRECTIVE_DEFINITION
2106 | SCHEMA_DEFINITION
2107 | SCALAR_TYPE_DEFINITION
2108 | OBJECT_TYPE_DEFINITION
2109 | INTERFACE_TYPE_DEFINITION
2110 | UNION_TYPE_DEFINITION
2111 | ENUM_TYPE_DEFINITION
2112 | INPUT_OBJECT_TYPE_DEFINITION
2113 | SCHEMA_EXTENSION
2114 | DIRECTIVE_EXTENSION
2115 | SCALAR_TYPE_EXTENSION
2116 | OBJECT_TYPE_EXTENSION
2117 | INTERFACE_TYPE_EXTENSION
2118 | UNION_TYPE_EXTENSION
2119 | ENUM_TYPE_EXTENSION
2120 | INPUT_OBJECT_TYPE_EXTENSION
2121 )
2122 }
2123 fn cast(syntax: SyntaxNode) -> Option<Self> {
2124 let res = match syntax.kind() {
2125 OPERATION_DEFINITION => Definition::OperationDefinition(OperationDefinition { syntax }),
2126 FRAGMENT_DEFINITION => Definition::FragmentDefinition(FragmentDefinition { syntax }),
2127 DIRECTIVE_DEFINITION => Definition::DirectiveDefinition(DirectiveDefinition { syntax }),
2128 SCHEMA_DEFINITION => Definition::SchemaDefinition(SchemaDefinition { syntax }),
2129 SCALAR_TYPE_DEFINITION => {
2130 Definition::ScalarTypeDefinition(ScalarTypeDefinition { syntax })
2131 }
2132 OBJECT_TYPE_DEFINITION => {
2133 Definition::ObjectTypeDefinition(ObjectTypeDefinition { syntax })
2134 }
2135 INTERFACE_TYPE_DEFINITION => {
2136 Definition::InterfaceTypeDefinition(InterfaceTypeDefinition { syntax })
2137 }
2138 UNION_TYPE_DEFINITION => {
2139 Definition::UnionTypeDefinition(UnionTypeDefinition { syntax })
2140 }
2141 ENUM_TYPE_DEFINITION => Definition::EnumTypeDefinition(EnumTypeDefinition { syntax }),
2142 INPUT_OBJECT_TYPE_DEFINITION => {
2143 Definition::InputObjectTypeDefinition(InputObjectTypeDefinition { syntax })
2144 }
2145 SCHEMA_EXTENSION => Definition::SchemaExtension(SchemaExtension { syntax }),
2146 DIRECTIVE_EXTENSION => Definition::DirectiveExtension(DirectiveExtension { syntax }),
2147 SCALAR_TYPE_EXTENSION => {
2148 Definition::ScalarTypeExtension(ScalarTypeExtension { syntax })
2149 }
2150 OBJECT_TYPE_EXTENSION => {
2151 Definition::ObjectTypeExtension(ObjectTypeExtension { syntax })
2152 }
2153 INTERFACE_TYPE_EXTENSION => {
2154 Definition::InterfaceTypeExtension(InterfaceTypeExtension { syntax })
2155 }
2156 UNION_TYPE_EXTENSION => Definition::UnionTypeExtension(UnionTypeExtension { syntax }),
2157 ENUM_TYPE_EXTENSION => Definition::EnumTypeExtension(EnumTypeExtension { syntax }),
2158 INPUT_OBJECT_TYPE_EXTENSION => {
2159 Definition::InputObjectTypeExtension(InputObjectTypeExtension { syntax })
2160 }
2161 _ => return None,
2162 };
2163 Some(res)
2164 }
2165 fn syntax(&self) -> &SyntaxNode {
2166 match self {
2167 Definition::OperationDefinition(it) => it.syntax(),
2168 Definition::FragmentDefinition(it) => it.syntax(),
2169 Definition::DirectiveDefinition(it) => it.syntax(),
2170 Definition::SchemaDefinition(it) => it.syntax(),
2171 Definition::ScalarTypeDefinition(it) => it.syntax(),
2172 Definition::ObjectTypeDefinition(it) => it.syntax(),
2173 Definition::InterfaceTypeDefinition(it) => it.syntax(),
2174 Definition::UnionTypeDefinition(it) => it.syntax(),
2175 Definition::EnumTypeDefinition(it) => it.syntax(),
2176 Definition::InputObjectTypeDefinition(it) => it.syntax(),
2177 Definition::SchemaExtension(it) => it.syntax(),
2178 Definition::DirectiveExtension(it) => it.syntax(),
2179 Definition::ScalarTypeExtension(it) => it.syntax(),
2180 Definition::ObjectTypeExtension(it) => it.syntax(),
2181 Definition::InterfaceTypeExtension(it) => it.syntax(),
2182 Definition::UnionTypeExtension(it) => it.syntax(),
2183 Definition::EnumTypeExtension(it) => it.syntax(),
2184 Definition::InputObjectTypeExtension(it) => it.syntax(),
2185 }
2186 }
2187}
2188impl From<Field> for Selection {
2189 fn from(node: Field) -> Selection {
2190 Selection::Field(node)
2191 }
2192}
2193impl From<FragmentSpread> for Selection {
2194 fn from(node: FragmentSpread) -> Selection {
2195 Selection::FragmentSpread(node)
2196 }
2197}
2198impl From<InlineFragment> for Selection {
2199 fn from(node: InlineFragment) -> Selection {
2200 Selection::InlineFragment(node)
2201 }
2202}
2203impl CstNode for Selection {
2204 fn can_cast(kind: SyntaxKind) -> bool {
2205 matches!(kind, FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT)
2206 }
2207 fn cast(syntax: SyntaxNode) -> Option<Self> {
2208 let res = match syntax.kind() {
2209 FIELD => Selection::Field(Field { syntax }),
2210 FRAGMENT_SPREAD => Selection::FragmentSpread(FragmentSpread { syntax }),
2211 INLINE_FRAGMENT => Selection::InlineFragment(InlineFragment { syntax }),
2212 _ => return None,
2213 };
2214 Some(res)
2215 }
2216 fn syntax(&self) -> &SyntaxNode {
2217 match self {
2218 Selection::Field(it) => it.syntax(),
2219 Selection::FragmentSpread(it) => it.syntax(),
2220 Selection::InlineFragment(it) => it.syntax(),
2221 }
2222 }
2223}
2224impl From<Variable> for Value {
2225 fn from(node: Variable) -> Value {
2226 Value::Variable(node)
2227 }
2228}
2229impl From<StringValue> for Value {
2230 fn from(node: StringValue) -> Value {
2231 Value::StringValue(node)
2232 }
2233}
2234impl From<FloatValue> for Value {
2235 fn from(node: FloatValue) -> Value {
2236 Value::FloatValue(node)
2237 }
2238}
2239impl From<IntValue> for Value {
2240 fn from(node: IntValue) -> Value {
2241 Value::IntValue(node)
2242 }
2243}
2244impl From<BooleanValue> for Value {
2245 fn from(node: BooleanValue) -> Value {
2246 Value::BooleanValue(node)
2247 }
2248}
2249impl From<NullValue> for Value {
2250 fn from(node: NullValue) -> Value {
2251 Value::NullValue(node)
2252 }
2253}
2254impl From<EnumValue> for Value {
2255 fn from(node: EnumValue) -> Value {
2256 Value::EnumValue(node)
2257 }
2258}
2259impl From<ListValue> for Value {
2260 fn from(node: ListValue) -> Value {
2261 Value::ListValue(node)
2262 }
2263}
2264impl From<ObjectValue> for Value {
2265 fn from(node: ObjectValue) -> Value {
2266 Value::ObjectValue(node)
2267 }
2268}
2269impl CstNode for Value {
2270 fn can_cast(kind: SyntaxKind) -> bool {
2271 matches!(
2272 kind,
2273 VARIABLE
2274 | STRING_VALUE
2275 | FLOAT_VALUE
2276 | INT_VALUE
2277 | BOOLEAN_VALUE
2278 | NULL_VALUE
2279 | ENUM_VALUE
2280 | LIST_VALUE
2281 | OBJECT_VALUE
2282 )
2283 }
2284 fn cast(syntax: SyntaxNode) -> Option<Self> {
2285 let res = match syntax.kind() {
2286 VARIABLE => Value::Variable(Variable { syntax }),
2287 STRING_VALUE => Value::StringValue(StringValue { syntax }),
2288 FLOAT_VALUE => Value::FloatValue(FloatValue { syntax }),
2289 INT_VALUE => Value::IntValue(IntValue { syntax }),
2290 BOOLEAN_VALUE => Value::BooleanValue(BooleanValue { syntax }),
2291 NULL_VALUE => Value::NullValue(NullValue { syntax }),
2292 ENUM_VALUE => Value::EnumValue(EnumValue { syntax }),
2293 LIST_VALUE => Value::ListValue(ListValue { syntax }),
2294 OBJECT_VALUE => Value::ObjectValue(ObjectValue { syntax }),
2295 _ => return None,
2296 };
2297 Some(res)
2298 }
2299 fn syntax(&self) -> &SyntaxNode {
2300 match self {
2301 Value::Variable(it) => it.syntax(),
2302 Value::StringValue(it) => it.syntax(),
2303 Value::FloatValue(it) => it.syntax(),
2304 Value::IntValue(it) => it.syntax(),
2305 Value::BooleanValue(it) => it.syntax(),
2306 Value::NullValue(it) => it.syntax(),
2307 Value::EnumValue(it) => it.syntax(),
2308 Value::ListValue(it) => it.syntax(),
2309 Value::ObjectValue(it) => it.syntax(),
2310 }
2311 }
2312}
2313impl From<NamedType> for Type {
2314 fn from(node: NamedType) -> Type {
2315 Type::NamedType(node)
2316 }
2317}
2318impl From<ListType> for Type {
2319 fn from(node: ListType) -> Type {
2320 Type::ListType(node)
2321 }
2322}
2323impl From<NonNullType> for Type {
2324 fn from(node: NonNullType) -> Type {
2325 Type::NonNullType(node)
2326 }
2327}
2328impl CstNode for Type {
2329 fn can_cast(kind: SyntaxKind) -> bool {
2330 matches!(kind, NAMED_TYPE | LIST_TYPE | NON_NULL_TYPE)
2331 }
2332 fn cast(syntax: SyntaxNode) -> Option<Self> {
2333 let res = match syntax.kind() {
2334 NAMED_TYPE => Type::NamedType(NamedType { syntax }),
2335 LIST_TYPE => Type::ListType(ListType { syntax }),
2336 NON_NULL_TYPE => Type::NonNullType(NonNullType { syntax }),
2337 _ => return None,
2338 };
2339 Some(res)
2340 }
2341 fn syntax(&self) -> &SyntaxNode {
2342 match self {
2343 Type::NamedType(it) => it.syntax(),
2344 Type::ListType(it) => it.syntax(),
2345 Type::NonNullType(it) => it.syntax(),
2346 }
2347 }
2348}