]> git.lizzy.rs Git - rust.git/blob - crates/ra_syntax/src/ast/generated.rs
Introduce dedicated AST node for union
[rust.git] / crates / ra_syntax / src / ast / generated.rs
1 //! Generated file, do not edit by hand, see `crate/ra_tools/src/codegen`
2
3 use crate::{
4     ast::{self, AstChildren, AstNode},
5     SyntaxKind::{self, *},
6     SyntaxNode,
7 };
8 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
9 pub struct Alias {
10     pub(crate) syntax: SyntaxNode,
11 }
12 impl AstNode for Alias {
13     fn can_cast(kind: SyntaxKind) -> bool {
14         match kind {
15             ALIAS => true,
16             _ => false,
17         }
18     }
19     fn cast(syntax: SyntaxNode) -> Option<Self> {
20         if Self::can_cast(syntax.kind()) {
21             Some(Self { syntax })
22         } else {
23             None
24         }
25     }
26     fn syntax(&self) -> &SyntaxNode {
27         &self.syntax
28     }
29 }
30 impl ast::NameOwner for Alias {}
31 impl Alias {}
32 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
33 pub struct ArgList {
34     pub(crate) syntax: SyntaxNode,
35 }
36 impl AstNode for ArgList {
37     fn can_cast(kind: SyntaxKind) -> bool {
38         match kind {
39             ARG_LIST => true,
40             _ => false,
41         }
42     }
43     fn cast(syntax: SyntaxNode) -> Option<Self> {
44         if Self::can_cast(syntax.kind()) {
45             Some(Self { syntax })
46         } else {
47             None
48         }
49     }
50     fn syntax(&self) -> &SyntaxNode {
51         &self.syntax
52     }
53 }
54 impl ArgList {
55     pub fn args(&self) -> AstChildren<Expr> {
56         AstChildren::new(&self.syntax)
57     }
58 }
59 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
60 pub struct ArrayExpr {
61     pub(crate) syntax: SyntaxNode,
62 }
63 impl AstNode for ArrayExpr {
64     fn can_cast(kind: SyntaxKind) -> bool {
65         match kind {
66             ARRAY_EXPR => true,
67             _ => false,
68         }
69     }
70     fn cast(syntax: SyntaxNode) -> Option<Self> {
71         if Self::can_cast(syntax.kind()) {
72             Some(Self { syntax })
73         } else {
74             None
75         }
76     }
77     fn syntax(&self) -> &SyntaxNode {
78         &self.syntax
79     }
80 }
81 impl ArrayExpr {
82     pub fn exprs(&self) -> AstChildren<Expr> {
83         AstChildren::new(&self.syntax)
84     }
85 }
86 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
87 pub struct ArrayType {
88     pub(crate) syntax: SyntaxNode,
89 }
90 impl AstNode for ArrayType {
91     fn can_cast(kind: SyntaxKind) -> bool {
92         match kind {
93             ARRAY_TYPE => true,
94             _ => false,
95         }
96     }
97     fn cast(syntax: SyntaxNode) -> Option<Self> {
98         if Self::can_cast(syntax.kind()) {
99             Some(Self { syntax })
100         } else {
101             None
102         }
103     }
104     fn syntax(&self) -> &SyntaxNode {
105         &self.syntax
106     }
107 }
108 impl ArrayType {
109     pub fn type_ref(&self) -> Option<TypeRef> {
110         AstChildren::new(&self.syntax).next()
111     }
112     pub fn expr(&self) -> Option<Expr> {
113         AstChildren::new(&self.syntax).next()
114     }
115 }
116 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
117 pub struct AssocTypeArg {
118     pub(crate) syntax: SyntaxNode,
119 }
120 impl AstNode for AssocTypeArg {
121     fn can_cast(kind: SyntaxKind) -> bool {
122         match kind {
123             ASSOC_TYPE_ARG => true,
124             _ => false,
125         }
126     }
127     fn cast(syntax: SyntaxNode) -> Option<Self> {
128         if Self::can_cast(syntax.kind()) {
129             Some(Self { syntax })
130         } else {
131             None
132         }
133     }
134     fn syntax(&self) -> &SyntaxNode {
135         &self.syntax
136     }
137 }
138 impl AssocTypeArg {
139     pub fn name_ref(&self) -> Option<NameRef> {
140         AstChildren::new(&self.syntax).next()
141     }
142     pub fn type_ref(&self) -> Option<TypeRef> {
143         AstChildren::new(&self.syntax).next()
144     }
145 }
146 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
147 pub struct Attr {
148     pub(crate) syntax: SyntaxNode,
149 }
150 impl AstNode for Attr {
151     fn can_cast(kind: SyntaxKind) -> bool {
152         match kind {
153             ATTR => true,
154             _ => false,
155         }
156     }
157     fn cast(syntax: SyntaxNode) -> Option<Self> {
158         if Self::can_cast(syntax.kind()) {
159             Some(Self { syntax })
160         } else {
161             None
162         }
163     }
164     fn syntax(&self) -> &SyntaxNode {
165         &self.syntax
166     }
167 }
168 impl Attr {
169     pub fn path(&self) -> Option<Path> {
170         AstChildren::new(&self.syntax).next()
171     }
172     pub fn input(&self) -> Option<AttrInput> {
173         AstChildren::new(&self.syntax).next()
174     }
175 }
176 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
177 pub enum AttrInput {
178     Literal(Literal),
179     TokenTree(TokenTree),
180 }
181 impl From<Literal> for AttrInput {
182     fn from(node: Literal) -> AttrInput {
183         AttrInput::Literal(node)
184     }
185 }
186 impl From<TokenTree> for AttrInput {
187     fn from(node: TokenTree) -> AttrInput {
188         AttrInput::TokenTree(node)
189     }
190 }
191 impl AstNode for AttrInput {
192     fn can_cast(kind: SyntaxKind) -> bool {
193         match kind {
194             LITERAL | TOKEN_TREE => true,
195             _ => false,
196         }
197     }
198     fn cast(syntax: SyntaxNode) -> Option<Self> {
199         let res = match syntax.kind() {
200             LITERAL => AttrInput::Literal(Literal { syntax }),
201             TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }),
202             _ => return None,
203         };
204         Some(res)
205     }
206     fn syntax(&self) -> &SyntaxNode {
207         match self {
208             AttrInput::Literal(it) => &it.syntax,
209             AttrInput::TokenTree(it) => &it.syntax,
210         }
211     }
212 }
213 impl AttrInput {}
214 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
215 pub struct AwaitExpr {
216     pub(crate) syntax: SyntaxNode,
217 }
218 impl AstNode for AwaitExpr {
219     fn can_cast(kind: SyntaxKind) -> bool {
220         match kind {
221             AWAIT_EXPR => true,
222             _ => false,
223         }
224     }
225     fn cast(syntax: SyntaxNode) -> Option<Self> {
226         if Self::can_cast(syntax.kind()) {
227             Some(Self { syntax })
228         } else {
229             None
230         }
231     }
232     fn syntax(&self) -> &SyntaxNode {
233         &self.syntax
234     }
235 }
236 impl AwaitExpr {
237     pub fn expr(&self) -> Option<Expr> {
238         AstChildren::new(&self.syntax).next()
239     }
240 }
241 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
242 pub struct BinExpr {
243     pub(crate) syntax: SyntaxNode,
244 }
245 impl AstNode for BinExpr {
246     fn can_cast(kind: SyntaxKind) -> bool {
247         match kind {
248             BIN_EXPR => true,
249             _ => false,
250         }
251     }
252     fn cast(syntax: SyntaxNode) -> Option<Self> {
253         if Self::can_cast(syntax.kind()) {
254             Some(Self { syntax })
255         } else {
256             None
257         }
258     }
259     fn syntax(&self) -> &SyntaxNode {
260         &self.syntax
261     }
262 }
263 impl BinExpr {}
264 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
265 pub struct BindPat {
266     pub(crate) syntax: SyntaxNode,
267 }
268 impl AstNode for BindPat {
269     fn can_cast(kind: SyntaxKind) -> bool {
270         match kind {
271             BIND_PAT => true,
272             _ => false,
273         }
274     }
275     fn cast(syntax: SyntaxNode) -> Option<Self> {
276         if Self::can_cast(syntax.kind()) {
277             Some(Self { syntax })
278         } else {
279             None
280         }
281     }
282     fn syntax(&self) -> &SyntaxNode {
283         &self.syntax
284     }
285 }
286 impl ast::NameOwner for BindPat {}
287 impl BindPat {
288     pub fn pat(&self) -> Option<Pat> {
289         AstChildren::new(&self.syntax).next()
290     }
291 }
292 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
293 pub struct Block {
294     pub(crate) syntax: SyntaxNode,
295 }
296 impl AstNode for Block {
297     fn can_cast(kind: SyntaxKind) -> bool {
298         match kind {
299             BLOCK => true,
300             _ => false,
301         }
302     }
303     fn cast(syntax: SyntaxNode) -> Option<Self> {
304         if Self::can_cast(syntax.kind()) {
305             Some(Self { syntax })
306         } else {
307             None
308         }
309     }
310     fn syntax(&self) -> &SyntaxNode {
311         &self.syntax
312     }
313 }
314 impl ast::AttrsOwner for Block {}
315 impl Block {
316     pub fn statements(&self) -> AstChildren<Stmt> {
317         AstChildren::new(&self.syntax)
318     }
319     pub fn expr(&self) -> Option<Expr> {
320         AstChildren::new(&self.syntax).next()
321     }
322 }
323 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
324 pub struct BlockExpr {
325     pub(crate) syntax: SyntaxNode,
326 }
327 impl AstNode for BlockExpr {
328     fn can_cast(kind: SyntaxKind) -> bool {
329         match kind {
330             BLOCK_EXPR => true,
331             _ => false,
332         }
333     }
334     fn cast(syntax: SyntaxNode) -> Option<Self> {
335         if Self::can_cast(syntax.kind()) {
336             Some(Self { syntax })
337         } else {
338             None
339         }
340     }
341     fn syntax(&self) -> &SyntaxNode {
342         &self.syntax
343     }
344 }
345 impl BlockExpr {
346     pub fn block(&self) -> Option<Block> {
347         AstChildren::new(&self.syntax).next()
348     }
349 }
350 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
351 pub struct BoxExpr {
352     pub(crate) syntax: SyntaxNode,
353 }
354 impl AstNode for BoxExpr {
355     fn can_cast(kind: SyntaxKind) -> bool {
356         match kind {
357             BOX_EXPR => true,
358             _ => false,
359         }
360     }
361     fn cast(syntax: SyntaxNode) -> Option<Self> {
362         if Self::can_cast(syntax.kind()) {
363             Some(Self { syntax })
364         } else {
365             None
366         }
367     }
368     fn syntax(&self) -> &SyntaxNode {
369         &self.syntax
370     }
371 }
372 impl BoxExpr {
373     pub fn expr(&self) -> Option<Expr> {
374         AstChildren::new(&self.syntax).next()
375     }
376 }
377 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
378 pub struct BoxPat {
379     pub(crate) syntax: SyntaxNode,
380 }
381 impl AstNode for BoxPat {
382     fn can_cast(kind: SyntaxKind) -> bool {
383         match kind {
384             BOX_PAT => true,
385             _ => false,
386         }
387     }
388     fn cast(syntax: SyntaxNode) -> Option<Self> {
389         if Self::can_cast(syntax.kind()) {
390             Some(Self { syntax })
391         } else {
392             None
393         }
394     }
395     fn syntax(&self) -> &SyntaxNode {
396         &self.syntax
397     }
398 }
399 impl BoxPat {
400     pub fn pat(&self) -> Option<Pat> {
401         AstChildren::new(&self.syntax).next()
402     }
403 }
404 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
405 pub struct BreakExpr {
406     pub(crate) syntax: SyntaxNode,
407 }
408 impl AstNode for BreakExpr {
409     fn can_cast(kind: SyntaxKind) -> bool {
410         match kind {
411             BREAK_EXPR => true,
412             _ => false,
413         }
414     }
415     fn cast(syntax: SyntaxNode) -> Option<Self> {
416         if Self::can_cast(syntax.kind()) {
417             Some(Self { syntax })
418         } else {
419             None
420         }
421     }
422     fn syntax(&self) -> &SyntaxNode {
423         &self.syntax
424     }
425 }
426 impl BreakExpr {
427     pub fn expr(&self) -> Option<Expr> {
428         AstChildren::new(&self.syntax).next()
429     }
430 }
431 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
432 pub struct CallExpr {
433     pub(crate) syntax: SyntaxNode,
434 }
435 impl AstNode for CallExpr {
436     fn can_cast(kind: SyntaxKind) -> bool {
437         match kind {
438             CALL_EXPR => true,
439             _ => false,
440         }
441     }
442     fn cast(syntax: SyntaxNode) -> Option<Self> {
443         if Self::can_cast(syntax.kind()) {
444             Some(Self { syntax })
445         } else {
446             None
447         }
448     }
449     fn syntax(&self) -> &SyntaxNode {
450         &self.syntax
451     }
452 }
453 impl ast::ArgListOwner for CallExpr {}
454 impl CallExpr {
455     pub fn expr(&self) -> Option<Expr> {
456         AstChildren::new(&self.syntax).next()
457     }
458 }
459 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
460 pub struct CastExpr {
461     pub(crate) syntax: SyntaxNode,
462 }
463 impl AstNode for CastExpr {
464     fn can_cast(kind: SyntaxKind) -> bool {
465         match kind {
466             CAST_EXPR => true,
467             _ => false,
468         }
469     }
470     fn cast(syntax: SyntaxNode) -> Option<Self> {
471         if Self::can_cast(syntax.kind()) {
472             Some(Self { syntax })
473         } else {
474             None
475         }
476     }
477     fn syntax(&self) -> &SyntaxNode {
478         &self.syntax
479     }
480 }
481 impl CastExpr {
482     pub fn expr(&self) -> Option<Expr> {
483         AstChildren::new(&self.syntax).next()
484     }
485     pub fn type_ref(&self) -> Option<TypeRef> {
486         AstChildren::new(&self.syntax).next()
487     }
488 }
489 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
490 pub struct Condition {
491     pub(crate) syntax: SyntaxNode,
492 }
493 impl AstNode for Condition {
494     fn can_cast(kind: SyntaxKind) -> bool {
495         match kind {
496             CONDITION => true,
497             _ => false,
498         }
499     }
500     fn cast(syntax: SyntaxNode) -> Option<Self> {
501         if Self::can_cast(syntax.kind()) {
502             Some(Self { syntax })
503         } else {
504             None
505         }
506     }
507     fn syntax(&self) -> &SyntaxNode {
508         &self.syntax
509     }
510 }
511 impl Condition {
512     pub fn pat(&self) -> Option<Pat> {
513         AstChildren::new(&self.syntax).next()
514     }
515     pub fn expr(&self) -> Option<Expr> {
516         AstChildren::new(&self.syntax).next()
517     }
518 }
519 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
520 pub struct ConstDef {
521     pub(crate) syntax: SyntaxNode,
522 }
523 impl AstNode for ConstDef {
524     fn can_cast(kind: SyntaxKind) -> bool {
525         match kind {
526             CONST_DEF => true,
527             _ => false,
528         }
529     }
530     fn cast(syntax: SyntaxNode) -> Option<Self> {
531         if Self::can_cast(syntax.kind()) {
532             Some(Self { syntax })
533         } else {
534             None
535         }
536     }
537     fn syntax(&self) -> &SyntaxNode {
538         &self.syntax
539     }
540 }
541 impl ast::VisibilityOwner for ConstDef {}
542 impl ast::NameOwner for ConstDef {}
543 impl ast::TypeParamsOwner for ConstDef {}
544 impl ast::AttrsOwner for ConstDef {}
545 impl ast::DocCommentsOwner for ConstDef {}
546 impl ast::TypeAscriptionOwner for ConstDef {}
547 impl ConstDef {
548     pub fn body(&self) -> Option<Expr> {
549         AstChildren::new(&self.syntax).next()
550     }
551 }
552 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
553 pub struct ContinueExpr {
554     pub(crate) syntax: SyntaxNode,
555 }
556 impl AstNode for ContinueExpr {
557     fn can_cast(kind: SyntaxKind) -> bool {
558         match kind {
559             CONTINUE_EXPR => true,
560             _ => false,
561         }
562     }
563     fn cast(syntax: SyntaxNode) -> Option<Self> {
564         if Self::can_cast(syntax.kind()) {
565             Some(Self { syntax })
566         } else {
567             None
568         }
569     }
570     fn syntax(&self) -> &SyntaxNode {
571         &self.syntax
572     }
573 }
574 impl ContinueExpr {}
575 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
576 pub struct DotDotPat {
577     pub(crate) syntax: SyntaxNode,
578 }
579 impl AstNode for DotDotPat {
580     fn can_cast(kind: SyntaxKind) -> bool {
581         match kind {
582             DOT_DOT_PAT => true,
583             _ => false,
584         }
585     }
586     fn cast(syntax: SyntaxNode) -> Option<Self> {
587         if Self::can_cast(syntax.kind()) {
588             Some(Self { syntax })
589         } else {
590             None
591         }
592     }
593     fn syntax(&self) -> &SyntaxNode {
594         &self.syntax
595     }
596 }
597 impl DotDotPat {}
598 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
599 pub struct DynTraitType {
600     pub(crate) syntax: SyntaxNode,
601 }
602 impl AstNode for DynTraitType {
603     fn can_cast(kind: SyntaxKind) -> bool {
604         match kind {
605             DYN_TRAIT_TYPE => true,
606             _ => false,
607         }
608     }
609     fn cast(syntax: SyntaxNode) -> Option<Self> {
610         if Self::can_cast(syntax.kind()) {
611             Some(Self { syntax })
612         } else {
613             None
614         }
615     }
616     fn syntax(&self) -> &SyntaxNode {
617         &self.syntax
618     }
619 }
620 impl ast::TypeBoundsOwner for DynTraitType {}
621 impl DynTraitType {}
622 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
623 pub struct EnumDef {
624     pub(crate) syntax: SyntaxNode,
625 }
626 impl AstNode for EnumDef {
627     fn can_cast(kind: SyntaxKind) -> bool {
628         match kind {
629             ENUM_DEF => true,
630             _ => false,
631         }
632     }
633     fn cast(syntax: SyntaxNode) -> Option<Self> {
634         if Self::can_cast(syntax.kind()) {
635             Some(Self { syntax })
636         } else {
637             None
638         }
639     }
640     fn syntax(&self) -> &SyntaxNode {
641         &self.syntax
642     }
643 }
644 impl ast::VisibilityOwner for EnumDef {}
645 impl ast::NameOwner for EnumDef {}
646 impl ast::TypeParamsOwner for EnumDef {}
647 impl ast::AttrsOwner for EnumDef {}
648 impl ast::DocCommentsOwner for EnumDef {}
649 impl EnumDef {
650     pub fn variant_list(&self) -> Option<EnumVariantList> {
651         AstChildren::new(&self.syntax).next()
652     }
653 }
654 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
655 pub struct EnumVariant {
656     pub(crate) syntax: SyntaxNode,
657 }
658 impl AstNode for EnumVariant {
659     fn can_cast(kind: SyntaxKind) -> bool {
660         match kind {
661             ENUM_VARIANT => true,
662             _ => false,
663         }
664     }
665     fn cast(syntax: SyntaxNode) -> Option<Self> {
666         if Self::can_cast(syntax.kind()) {
667             Some(Self { syntax })
668         } else {
669             None
670         }
671     }
672     fn syntax(&self) -> &SyntaxNode {
673         &self.syntax
674     }
675 }
676 impl ast::NameOwner for EnumVariant {}
677 impl ast::DocCommentsOwner for EnumVariant {}
678 impl ast::AttrsOwner for EnumVariant {}
679 impl EnumVariant {
680     pub fn expr(&self) -> Option<Expr> {
681         AstChildren::new(&self.syntax).next()
682     }
683 }
684 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
685 pub struct EnumVariantList {
686     pub(crate) syntax: SyntaxNode,
687 }
688 impl AstNode for EnumVariantList {
689     fn can_cast(kind: SyntaxKind) -> bool {
690         match kind {
691             ENUM_VARIANT_LIST => true,
692             _ => false,
693         }
694     }
695     fn cast(syntax: SyntaxNode) -> Option<Self> {
696         if Self::can_cast(syntax.kind()) {
697             Some(Self { syntax })
698         } else {
699             None
700         }
701     }
702     fn syntax(&self) -> &SyntaxNode {
703         &self.syntax
704     }
705 }
706 impl EnumVariantList {
707     pub fn variants(&self) -> AstChildren<EnumVariant> {
708         AstChildren::new(&self.syntax)
709     }
710 }
711 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
712 pub enum Expr {
713     TupleExpr(TupleExpr),
714     ArrayExpr(ArrayExpr),
715     ParenExpr(ParenExpr),
716     PathExpr(PathExpr),
717     LambdaExpr(LambdaExpr),
718     IfExpr(IfExpr),
719     LoopExpr(LoopExpr),
720     ForExpr(ForExpr),
721     WhileExpr(WhileExpr),
722     ContinueExpr(ContinueExpr),
723     BreakExpr(BreakExpr),
724     Label(Label),
725     BlockExpr(BlockExpr),
726     ReturnExpr(ReturnExpr),
727     MatchExpr(MatchExpr),
728     RecordLit(RecordLit),
729     CallExpr(CallExpr),
730     IndexExpr(IndexExpr),
731     MethodCallExpr(MethodCallExpr),
732     FieldExpr(FieldExpr),
733     AwaitExpr(AwaitExpr),
734     TryExpr(TryExpr),
735     TryBlockExpr(TryBlockExpr),
736     CastExpr(CastExpr),
737     RefExpr(RefExpr),
738     PrefixExpr(PrefixExpr),
739     RangeExpr(RangeExpr),
740     BinExpr(BinExpr),
741     Literal(Literal),
742     MacroCall(MacroCall),
743     BoxExpr(BoxExpr),
744 }
745 impl From<TupleExpr> for Expr {
746     fn from(node: TupleExpr) -> Expr {
747         Expr::TupleExpr(node)
748     }
749 }
750 impl From<ArrayExpr> for Expr {
751     fn from(node: ArrayExpr) -> Expr {
752         Expr::ArrayExpr(node)
753     }
754 }
755 impl From<ParenExpr> for Expr {
756     fn from(node: ParenExpr) -> Expr {
757         Expr::ParenExpr(node)
758     }
759 }
760 impl From<PathExpr> for Expr {
761     fn from(node: PathExpr) -> Expr {
762         Expr::PathExpr(node)
763     }
764 }
765 impl From<LambdaExpr> for Expr {
766     fn from(node: LambdaExpr) -> Expr {
767         Expr::LambdaExpr(node)
768     }
769 }
770 impl From<IfExpr> for Expr {
771     fn from(node: IfExpr) -> Expr {
772         Expr::IfExpr(node)
773     }
774 }
775 impl From<LoopExpr> for Expr {
776     fn from(node: LoopExpr) -> Expr {
777         Expr::LoopExpr(node)
778     }
779 }
780 impl From<ForExpr> for Expr {
781     fn from(node: ForExpr) -> Expr {
782         Expr::ForExpr(node)
783     }
784 }
785 impl From<WhileExpr> for Expr {
786     fn from(node: WhileExpr) -> Expr {
787         Expr::WhileExpr(node)
788     }
789 }
790 impl From<ContinueExpr> for Expr {
791     fn from(node: ContinueExpr) -> Expr {
792         Expr::ContinueExpr(node)
793     }
794 }
795 impl From<BreakExpr> for Expr {
796     fn from(node: BreakExpr) -> Expr {
797         Expr::BreakExpr(node)
798     }
799 }
800 impl From<Label> for Expr {
801     fn from(node: Label) -> Expr {
802         Expr::Label(node)
803     }
804 }
805 impl From<BlockExpr> for Expr {
806     fn from(node: BlockExpr) -> Expr {
807         Expr::BlockExpr(node)
808     }
809 }
810 impl From<ReturnExpr> for Expr {
811     fn from(node: ReturnExpr) -> Expr {
812         Expr::ReturnExpr(node)
813     }
814 }
815 impl From<MatchExpr> for Expr {
816     fn from(node: MatchExpr) -> Expr {
817         Expr::MatchExpr(node)
818     }
819 }
820 impl From<RecordLit> for Expr {
821     fn from(node: RecordLit) -> Expr {
822         Expr::RecordLit(node)
823     }
824 }
825 impl From<CallExpr> for Expr {
826     fn from(node: CallExpr) -> Expr {
827         Expr::CallExpr(node)
828     }
829 }
830 impl From<IndexExpr> for Expr {
831     fn from(node: IndexExpr) -> Expr {
832         Expr::IndexExpr(node)
833     }
834 }
835 impl From<MethodCallExpr> for Expr {
836     fn from(node: MethodCallExpr) -> Expr {
837         Expr::MethodCallExpr(node)
838     }
839 }
840 impl From<FieldExpr> for Expr {
841     fn from(node: FieldExpr) -> Expr {
842         Expr::FieldExpr(node)
843     }
844 }
845 impl From<AwaitExpr> for Expr {
846     fn from(node: AwaitExpr) -> Expr {
847         Expr::AwaitExpr(node)
848     }
849 }
850 impl From<TryExpr> for Expr {
851     fn from(node: TryExpr) -> Expr {
852         Expr::TryExpr(node)
853     }
854 }
855 impl From<TryBlockExpr> for Expr {
856     fn from(node: TryBlockExpr) -> Expr {
857         Expr::TryBlockExpr(node)
858     }
859 }
860 impl From<CastExpr> for Expr {
861     fn from(node: CastExpr) -> Expr {
862         Expr::CastExpr(node)
863     }
864 }
865 impl From<RefExpr> for Expr {
866     fn from(node: RefExpr) -> Expr {
867         Expr::RefExpr(node)
868     }
869 }
870 impl From<PrefixExpr> for Expr {
871     fn from(node: PrefixExpr) -> Expr {
872         Expr::PrefixExpr(node)
873     }
874 }
875 impl From<RangeExpr> for Expr {
876     fn from(node: RangeExpr) -> Expr {
877         Expr::RangeExpr(node)
878     }
879 }
880 impl From<BinExpr> for Expr {
881     fn from(node: BinExpr) -> Expr {
882         Expr::BinExpr(node)
883     }
884 }
885 impl From<Literal> for Expr {
886     fn from(node: Literal) -> Expr {
887         Expr::Literal(node)
888     }
889 }
890 impl From<MacroCall> for Expr {
891     fn from(node: MacroCall) -> Expr {
892         Expr::MacroCall(node)
893     }
894 }
895 impl From<BoxExpr> for Expr {
896     fn from(node: BoxExpr) -> Expr {
897         Expr::BoxExpr(node)
898     }
899 }
900 impl AstNode for Expr {
901     fn can_cast(kind: SyntaxKind) -> bool {
902         match kind {
903             TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR
904             | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
905             | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR
906             | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR
907             | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL
908             | BOX_EXPR => true,
909             _ => false,
910         }
911     }
912     fn cast(syntax: SyntaxNode) -> Option<Self> {
913         let res = match syntax.kind() {
914             TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
915             ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
916             PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
917             PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
918             LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }),
919             IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
920             LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
921             FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
922             WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
923             CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
924             BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
925             LABEL => Expr::Label(Label { syntax }),
926             BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
927             RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
928             MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
929             RECORD_LIT => Expr::RecordLit(RecordLit { syntax }),
930             CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
931             INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
932             METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
933             FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
934             AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
935             TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
936             TRY_BLOCK_EXPR => Expr::TryBlockExpr(TryBlockExpr { syntax }),
937             CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
938             REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
939             PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
940             RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
941             BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
942             LITERAL => Expr::Literal(Literal { syntax }),
943             MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
944             BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
945             _ => return None,
946         };
947         Some(res)
948     }
949     fn syntax(&self) -> &SyntaxNode {
950         match self {
951             Expr::TupleExpr(it) => &it.syntax,
952             Expr::ArrayExpr(it) => &it.syntax,
953             Expr::ParenExpr(it) => &it.syntax,
954             Expr::PathExpr(it) => &it.syntax,
955             Expr::LambdaExpr(it) => &it.syntax,
956             Expr::IfExpr(it) => &it.syntax,
957             Expr::LoopExpr(it) => &it.syntax,
958             Expr::ForExpr(it) => &it.syntax,
959             Expr::WhileExpr(it) => &it.syntax,
960             Expr::ContinueExpr(it) => &it.syntax,
961             Expr::BreakExpr(it) => &it.syntax,
962             Expr::Label(it) => &it.syntax,
963             Expr::BlockExpr(it) => &it.syntax,
964             Expr::ReturnExpr(it) => &it.syntax,
965             Expr::MatchExpr(it) => &it.syntax,
966             Expr::RecordLit(it) => &it.syntax,
967             Expr::CallExpr(it) => &it.syntax,
968             Expr::IndexExpr(it) => &it.syntax,
969             Expr::MethodCallExpr(it) => &it.syntax,
970             Expr::FieldExpr(it) => &it.syntax,
971             Expr::AwaitExpr(it) => &it.syntax,
972             Expr::TryExpr(it) => &it.syntax,
973             Expr::TryBlockExpr(it) => &it.syntax,
974             Expr::CastExpr(it) => &it.syntax,
975             Expr::RefExpr(it) => &it.syntax,
976             Expr::PrefixExpr(it) => &it.syntax,
977             Expr::RangeExpr(it) => &it.syntax,
978             Expr::BinExpr(it) => &it.syntax,
979             Expr::Literal(it) => &it.syntax,
980             Expr::MacroCall(it) => &it.syntax,
981             Expr::BoxExpr(it) => &it.syntax,
982         }
983     }
984 }
985 impl Expr {}
986 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
987 pub struct ExprStmt {
988     pub(crate) syntax: SyntaxNode,
989 }
990 impl AstNode for ExprStmt {
991     fn can_cast(kind: SyntaxKind) -> bool {
992         match kind {
993             EXPR_STMT => true,
994             _ => false,
995         }
996     }
997     fn cast(syntax: SyntaxNode) -> Option<Self> {
998         if Self::can_cast(syntax.kind()) {
999             Some(Self { syntax })
1000         } else {
1001             None
1002         }
1003     }
1004     fn syntax(&self) -> &SyntaxNode {
1005         &self.syntax
1006     }
1007 }
1008 impl ExprStmt {
1009     pub fn expr(&self) -> Option<Expr> {
1010         AstChildren::new(&self.syntax).next()
1011     }
1012 }
1013 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1014 pub struct ExternCrateItem {
1015     pub(crate) syntax: SyntaxNode,
1016 }
1017 impl AstNode for ExternCrateItem {
1018     fn can_cast(kind: SyntaxKind) -> bool {
1019         match kind {
1020             EXTERN_CRATE_ITEM => true,
1021             _ => false,
1022         }
1023     }
1024     fn cast(syntax: SyntaxNode) -> Option<Self> {
1025         if Self::can_cast(syntax.kind()) {
1026             Some(Self { syntax })
1027         } else {
1028             None
1029         }
1030     }
1031     fn syntax(&self) -> &SyntaxNode {
1032         &self.syntax
1033     }
1034 }
1035 impl ast::AttrsOwner for ExternCrateItem {}
1036 impl ExternCrateItem {
1037     pub fn name_ref(&self) -> Option<NameRef> {
1038         AstChildren::new(&self.syntax).next()
1039     }
1040     pub fn alias(&self) -> Option<Alias> {
1041         AstChildren::new(&self.syntax).next()
1042     }
1043 }
1044 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1045 pub struct FieldExpr {
1046     pub(crate) syntax: SyntaxNode,
1047 }
1048 impl AstNode for FieldExpr {
1049     fn can_cast(kind: SyntaxKind) -> bool {
1050         match kind {
1051             FIELD_EXPR => true,
1052             _ => false,
1053         }
1054     }
1055     fn cast(syntax: SyntaxNode) -> Option<Self> {
1056         if Self::can_cast(syntax.kind()) {
1057             Some(Self { syntax })
1058         } else {
1059             None
1060         }
1061     }
1062     fn syntax(&self) -> &SyntaxNode {
1063         &self.syntax
1064     }
1065 }
1066 impl FieldExpr {
1067     pub fn expr(&self) -> Option<Expr> {
1068         AstChildren::new(&self.syntax).next()
1069     }
1070     pub fn name_ref(&self) -> Option<NameRef> {
1071         AstChildren::new(&self.syntax).next()
1072     }
1073 }
1074 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1075 pub struct FnDef {
1076     pub(crate) syntax: SyntaxNode,
1077 }
1078 impl AstNode for FnDef {
1079     fn can_cast(kind: SyntaxKind) -> bool {
1080         match kind {
1081             FN_DEF => true,
1082             _ => false,
1083         }
1084     }
1085     fn cast(syntax: SyntaxNode) -> Option<Self> {
1086         if Self::can_cast(syntax.kind()) {
1087             Some(Self { syntax })
1088         } else {
1089             None
1090         }
1091     }
1092     fn syntax(&self) -> &SyntaxNode {
1093         &self.syntax
1094     }
1095 }
1096 impl ast::VisibilityOwner for FnDef {}
1097 impl ast::NameOwner for FnDef {}
1098 impl ast::TypeParamsOwner for FnDef {}
1099 impl ast::AttrsOwner for FnDef {}
1100 impl ast::DocCommentsOwner for FnDef {}
1101 impl FnDef {
1102     pub fn param_list(&self) -> Option<ParamList> {
1103         AstChildren::new(&self.syntax).next()
1104     }
1105     pub fn body(&self) -> Option<BlockExpr> {
1106         AstChildren::new(&self.syntax).next()
1107     }
1108     pub fn ret_type(&self) -> Option<RetType> {
1109         AstChildren::new(&self.syntax).next()
1110     }
1111 }
1112 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1113 pub struct FnPointerType {
1114     pub(crate) syntax: SyntaxNode,
1115 }
1116 impl AstNode for FnPointerType {
1117     fn can_cast(kind: SyntaxKind) -> bool {
1118         match kind {
1119             FN_POINTER_TYPE => true,
1120             _ => false,
1121         }
1122     }
1123     fn cast(syntax: SyntaxNode) -> Option<Self> {
1124         if Self::can_cast(syntax.kind()) {
1125             Some(Self { syntax })
1126         } else {
1127             None
1128         }
1129     }
1130     fn syntax(&self) -> &SyntaxNode {
1131         &self.syntax
1132     }
1133 }
1134 impl FnPointerType {
1135     pub fn param_list(&self) -> Option<ParamList> {
1136         AstChildren::new(&self.syntax).next()
1137     }
1138     pub fn ret_type(&self) -> Option<RetType> {
1139         AstChildren::new(&self.syntax).next()
1140     }
1141 }
1142 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1143 pub struct ForExpr {
1144     pub(crate) syntax: SyntaxNode,
1145 }
1146 impl AstNode for ForExpr {
1147     fn can_cast(kind: SyntaxKind) -> bool {
1148         match kind {
1149             FOR_EXPR => true,
1150             _ => false,
1151         }
1152     }
1153     fn cast(syntax: SyntaxNode) -> Option<Self> {
1154         if Self::can_cast(syntax.kind()) {
1155             Some(Self { syntax })
1156         } else {
1157             None
1158         }
1159     }
1160     fn syntax(&self) -> &SyntaxNode {
1161         &self.syntax
1162     }
1163 }
1164 impl ast::LoopBodyOwner for ForExpr {}
1165 impl ForExpr {
1166     pub fn pat(&self) -> Option<Pat> {
1167         AstChildren::new(&self.syntax).next()
1168     }
1169     pub fn iterable(&self) -> Option<Expr> {
1170         AstChildren::new(&self.syntax).next()
1171     }
1172 }
1173 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1174 pub struct ForType {
1175     pub(crate) syntax: SyntaxNode,
1176 }
1177 impl AstNode for ForType {
1178     fn can_cast(kind: SyntaxKind) -> bool {
1179         match kind {
1180             FOR_TYPE => true,
1181             _ => false,
1182         }
1183     }
1184     fn cast(syntax: SyntaxNode) -> Option<Self> {
1185         if Self::can_cast(syntax.kind()) {
1186             Some(Self { syntax })
1187         } else {
1188             None
1189         }
1190     }
1191     fn syntax(&self) -> &SyntaxNode {
1192         &self.syntax
1193     }
1194 }
1195 impl ForType {
1196     pub fn type_ref(&self) -> Option<TypeRef> {
1197         AstChildren::new(&self.syntax).next()
1198     }
1199 }
1200 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1201 pub struct IfExpr {
1202     pub(crate) syntax: SyntaxNode,
1203 }
1204 impl AstNode for IfExpr {
1205     fn can_cast(kind: SyntaxKind) -> bool {
1206         match kind {
1207             IF_EXPR => true,
1208             _ => false,
1209         }
1210     }
1211     fn cast(syntax: SyntaxNode) -> Option<Self> {
1212         if Self::can_cast(syntax.kind()) {
1213             Some(Self { syntax })
1214         } else {
1215             None
1216         }
1217     }
1218     fn syntax(&self) -> &SyntaxNode {
1219         &self.syntax
1220     }
1221 }
1222 impl IfExpr {
1223     pub fn condition(&self) -> Option<Condition> {
1224         AstChildren::new(&self.syntax).next()
1225     }
1226 }
1227 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1228 pub struct ImplBlock {
1229     pub(crate) syntax: SyntaxNode,
1230 }
1231 impl AstNode for ImplBlock {
1232     fn can_cast(kind: SyntaxKind) -> bool {
1233         match kind {
1234             IMPL_BLOCK => true,
1235             _ => false,
1236         }
1237     }
1238     fn cast(syntax: SyntaxNode) -> Option<Self> {
1239         if Self::can_cast(syntax.kind()) {
1240             Some(Self { syntax })
1241         } else {
1242             None
1243         }
1244     }
1245     fn syntax(&self) -> &SyntaxNode {
1246         &self.syntax
1247     }
1248 }
1249 impl ast::TypeParamsOwner for ImplBlock {}
1250 impl ast::AttrsOwner for ImplBlock {}
1251 impl ImplBlock {
1252     pub fn item_list(&self) -> Option<ItemList> {
1253         AstChildren::new(&self.syntax).next()
1254     }
1255 }
1256 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1257 pub enum ImplItem {
1258     FnDef(FnDef),
1259     TypeAliasDef(TypeAliasDef),
1260     ConstDef(ConstDef),
1261 }
1262 impl From<FnDef> for ImplItem {
1263     fn from(node: FnDef) -> ImplItem {
1264         ImplItem::FnDef(node)
1265     }
1266 }
1267 impl From<TypeAliasDef> for ImplItem {
1268     fn from(node: TypeAliasDef) -> ImplItem {
1269         ImplItem::TypeAliasDef(node)
1270     }
1271 }
1272 impl From<ConstDef> for ImplItem {
1273     fn from(node: ConstDef) -> ImplItem {
1274         ImplItem::ConstDef(node)
1275     }
1276 }
1277 impl AstNode for ImplItem {
1278     fn can_cast(kind: SyntaxKind) -> bool {
1279         match kind {
1280             FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
1281             _ => false,
1282         }
1283     }
1284     fn cast(syntax: SyntaxNode) -> Option<Self> {
1285         let res = match syntax.kind() {
1286             FN_DEF => ImplItem::FnDef(FnDef { syntax }),
1287             TYPE_ALIAS_DEF => ImplItem::TypeAliasDef(TypeAliasDef { syntax }),
1288             CONST_DEF => ImplItem::ConstDef(ConstDef { syntax }),
1289             _ => return None,
1290         };
1291         Some(res)
1292     }
1293     fn syntax(&self) -> &SyntaxNode {
1294         match self {
1295             ImplItem::FnDef(it) => &it.syntax,
1296             ImplItem::TypeAliasDef(it) => &it.syntax,
1297             ImplItem::ConstDef(it) => &it.syntax,
1298         }
1299     }
1300 }
1301 impl ast::AttrsOwner for ImplItem {}
1302 impl ImplItem {}
1303 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1304 pub struct ImplTraitType {
1305     pub(crate) syntax: SyntaxNode,
1306 }
1307 impl AstNode for ImplTraitType {
1308     fn can_cast(kind: SyntaxKind) -> bool {
1309         match kind {
1310             IMPL_TRAIT_TYPE => true,
1311             _ => false,
1312         }
1313     }
1314     fn cast(syntax: SyntaxNode) -> Option<Self> {
1315         if Self::can_cast(syntax.kind()) {
1316             Some(Self { syntax })
1317         } else {
1318             None
1319         }
1320     }
1321     fn syntax(&self) -> &SyntaxNode {
1322         &self.syntax
1323     }
1324 }
1325 impl ast::TypeBoundsOwner for ImplTraitType {}
1326 impl ImplTraitType {}
1327 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1328 pub struct IndexExpr {
1329     pub(crate) syntax: SyntaxNode,
1330 }
1331 impl AstNode for IndexExpr {
1332     fn can_cast(kind: SyntaxKind) -> bool {
1333         match kind {
1334             INDEX_EXPR => true,
1335             _ => false,
1336         }
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 }
1349 impl IndexExpr {}
1350 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1351 pub struct ItemList {
1352     pub(crate) syntax: SyntaxNode,
1353 }
1354 impl AstNode for ItemList {
1355     fn can_cast(kind: SyntaxKind) -> bool {
1356         match kind {
1357             ITEM_LIST => true,
1358             _ => false,
1359         }
1360     }
1361     fn cast(syntax: SyntaxNode) -> Option<Self> {
1362         if Self::can_cast(syntax.kind()) {
1363             Some(Self { syntax })
1364         } else {
1365             None
1366         }
1367     }
1368     fn syntax(&self) -> &SyntaxNode {
1369         &self.syntax
1370     }
1371 }
1372 impl ast::FnDefOwner for ItemList {}
1373 impl ast::ModuleItemOwner for ItemList {}
1374 impl ItemList {
1375     pub fn impl_items(&self) -> AstChildren<ImplItem> {
1376         AstChildren::new(&self.syntax)
1377     }
1378 }
1379 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1380 pub struct Label {
1381     pub(crate) syntax: SyntaxNode,
1382 }
1383 impl AstNode for Label {
1384     fn can_cast(kind: SyntaxKind) -> bool {
1385         match kind {
1386             LABEL => true,
1387             _ => false,
1388         }
1389     }
1390     fn cast(syntax: SyntaxNode) -> Option<Self> {
1391         if Self::can_cast(syntax.kind()) {
1392             Some(Self { syntax })
1393         } else {
1394             None
1395         }
1396     }
1397     fn syntax(&self) -> &SyntaxNode {
1398         &self.syntax
1399     }
1400 }
1401 impl Label {}
1402 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1403 pub struct LambdaExpr {
1404     pub(crate) syntax: SyntaxNode,
1405 }
1406 impl AstNode for LambdaExpr {
1407     fn can_cast(kind: SyntaxKind) -> bool {
1408         match kind {
1409             LAMBDA_EXPR => true,
1410             _ => false,
1411         }
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 }
1424 impl LambdaExpr {
1425     pub fn param_list(&self) -> Option<ParamList> {
1426         AstChildren::new(&self.syntax).next()
1427     }
1428     pub fn body(&self) -> Option<Expr> {
1429         AstChildren::new(&self.syntax).next()
1430     }
1431 }
1432 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1433 pub struct LetStmt {
1434     pub(crate) syntax: SyntaxNode,
1435 }
1436 impl AstNode for LetStmt {
1437     fn can_cast(kind: SyntaxKind) -> bool {
1438         match kind {
1439             LET_STMT => true,
1440             _ => false,
1441         }
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 }
1454 impl ast::TypeAscriptionOwner for LetStmt {}
1455 impl LetStmt {
1456     pub fn pat(&self) -> Option<Pat> {
1457         AstChildren::new(&self.syntax).next()
1458     }
1459     pub fn initializer(&self) -> Option<Expr> {
1460         AstChildren::new(&self.syntax).next()
1461     }
1462 }
1463 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1464 pub struct LifetimeArg {
1465     pub(crate) syntax: SyntaxNode,
1466 }
1467 impl AstNode for LifetimeArg {
1468     fn can_cast(kind: SyntaxKind) -> bool {
1469         match kind {
1470             LIFETIME_ARG => true,
1471             _ => false,
1472         }
1473     }
1474     fn cast(syntax: SyntaxNode) -> Option<Self> {
1475         if Self::can_cast(syntax.kind()) {
1476             Some(Self { syntax })
1477         } else {
1478             None
1479         }
1480     }
1481     fn syntax(&self) -> &SyntaxNode {
1482         &self.syntax
1483     }
1484 }
1485 impl LifetimeArg {}
1486 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1487 pub struct LifetimeParam {
1488     pub(crate) syntax: SyntaxNode,
1489 }
1490 impl AstNode for LifetimeParam {
1491     fn can_cast(kind: SyntaxKind) -> bool {
1492         match kind {
1493             LIFETIME_PARAM => true,
1494             _ => false,
1495         }
1496     }
1497     fn cast(syntax: SyntaxNode) -> Option<Self> {
1498         if Self::can_cast(syntax.kind()) {
1499             Some(Self { syntax })
1500         } else {
1501             None
1502         }
1503     }
1504     fn syntax(&self) -> &SyntaxNode {
1505         &self.syntax
1506     }
1507 }
1508 impl ast::AttrsOwner for LifetimeParam {}
1509 impl LifetimeParam {}
1510 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1511 pub struct Literal {
1512     pub(crate) syntax: SyntaxNode,
1513 }
1514 impl AstNode for Literal {
1515     fn can_cast(kind: SyntaxKind) -> bool {
1516         match kind {
1517             LITERAL => true,
1518             _ => false,
1519         }
1520     }
1521     fn cast(syntax: SyntaxNode) -> Option<Self> {
1522         if Self::can_cast(syntax.kind()) {
1523             Some(Self { syntax })
1524         } else {
1525             None
1526         }
1527     }
1528     fn syntax(&self) -> &SyntaxNode {
1529         &self.syntax
1530     }
1531 }
1532 impl Literal {}
1533 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1534 pub struct LiteralPat {
1535     pub(crate) syntax: SyntaxNode,
1536 }
1537 impl AstNode for LiteralPat {
1538     fn can_cast(kind: SyntaxKind) -> bool {
1539         match kind {
1540             LITERAL_PAT => true,
1541             _ => false,
1542         }
1543     }
1544     fn cast(syntax: SyntaxNode) -> Option<Self> {
1545         if Self::can_cast(syntax.kind()) {
1546             Some(Self { syntax })
1547         } else {
1548             None
1549         }
1550     }
1551     fn syntax(&self) -> &SyntaxNode {
1552         &self.syntax
1553     }
1554 }
1555 impl LiteralPat {
1556     pub fn literal(&self) -> Option<Literal> {
1557         AstChildren::new(&self.syntax).next()
1558     }
1559 }
1560 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1561 pub struct LoopExpr {
1562     pub(crate) syntax: SyntaxNode,
1563 }
1564 impl AstNode for LoopExpr {
1565     fn can_cast(kind: SyntaxKind) -> bool {
1566         match kind {
1567             LOOP_EXPR => true,
1568             _ => false,
1569         }
1570     }
1571     fn cast(syntax: SyntaxNode) -> Option<Self> {
1572         if Self::can_cast(syntax.kind()) {
1573             Some(Self { syntax })
1574         } else {
1575             None
1576         }
1577     }
1578     fn syntax(&self) -> &SyntaxNode {
1579         &self.syntax
1580     }
1581 }
1582 impl ast::LoopBodyOwner for LoopExpr {}
1583 impl LoopExpr {}
1584 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1585 pub struct MacroCall {
1586     pub(crate) syntax: SyntaxNode,
1587 }
1588 impl AstNode for MacroCall {
1589     fn can_cast(kind: SyntaxKind) -> bool {
1590         match kind {
1591             MACRO_CALL => true,
1592             _ => false,
1593         }
1594     }
1595     fn cast(syntax: SyntaxNode) -> Option<Self> {
1596         if Self::can_cast(syntax.kind()) {
1597             Some(Self { syntax })
1598         } else {
1599             None
1600         }
1601     }
1602     fn syntax(&self) -> &SyntaxNode {
1603         &self.syntax
1604     }
1605 }
1606 impl ast::NameOwner for MacroCall {}
1607 impl ast::AttrsOwner for MacroCall {}
1608 impl ast::DocCommentsOwner for MacroCall {}
1609 impl MacroCall {
1610     pub fn token_tree(&self) -> Option<TokenTree> {
1611         AstChildren::new(&self.syntax).next()
1612     }
1613     pub fn path(&self) -> Option<Path> {
1614         AstChildren::new(&self.syntax).next()
1615     }
1616 }
1617 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1618 pub struct MacroItems {
1619     pub(crate) syntax: SyntaxNode,
1620 }
1621 impl AstNode for MacroItems {
1622     fn can_cast(kind: SyntaxKind) -> bool {
1623         match kind {
1624             MACRO_ITEMS => true,
1625             _ => false,
1626         }
1627     }
1628     fn cast(syntax: SyntaxNode) -> Option<Self> {
1629         if Self::can_cast(syntax.kind()) {
1630             Some(Self { syntax })
1631         } else {
1632             None
1633         }
1634     }
1635     fn syntax(&self) -> &SyntaxNode {
1636         &self.syntax
1637     }
1638 }
1639 impl ast::ModuleItemOwner for MacroItems {}
1640 impl ast::FnDefOwner for MacroItems {}
1641 impl MacroItems {}
1642 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1643 pub struct MacroStmts {
1644     pub(crate) syntax: SyntaxNode,
1645 }
1646 impl AstNode for MacroStmts {
1647     fn can_cast(kind: SyntaxKind) -> bool {
1648         match kind {
1649             MACRO_STMTS => true,
1650             _ => false,
1651         }
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 }
1664 impl MacroStmts {
1665     pub fn statements(&self) -> AstChildren<Stmt> {
1666         AstChildren::new(&self.syntax)
1667     }
1668     pub fn expr(&self) -> Option<Expr> {
1669         AstChildren::new(&self.syntax).next()
1670     }
1671 }
1672 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1673 pub struct MatchArm {
1674     pub(crate) syntax: SyntaxNode,
1675 }
1676 impl AstNode for MatchArm {
1677     fn can_cast(kind: SyntaxKind) -> bool {
1678         match kind {
1679             MATCH_ARM => true,
1680             _ => false,
1681         }
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 }
1694 impl ast::AttrsOwner for MatchArm {}
1695 impl MatchArm {
1696     pub fn pats(&self) -> AstChildren<Pat> {
1697         AstChildren::new(&self.syntax)
1698     }
1699     pub fn guard(&self) -> Option<MatchGuard> {
1700         AstChildren::new(&self.syntax).next()
1701     }
1702     pub fn expr(&self) -> Option<Expr> {
1703         AstChildren::new(&self.syntax).next()
1704     }
1705 }
1706 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1707 pub struct MatchArmList {
1708     pub(crate) syntax: SyntaxNode,
1709 }
1710 impl AstNode for MatchArmList {
1711     fn can_cast(kind: SyntaxKind) -> bool {
1712         match kind {
1713             MATCH_ARM_LIST => true,
1714             _ => false,
1715         }
1716     }
1717     fn cast(syntax: SyntaxNode) -> Option<Self> {
1718         if Self::can_cast(syntax.kind()) {
1719             Some(Self { syntax })
1720         } else {
1721             None
1722         }
1723     }
1724     fn syntax(&self) -> &SyntaxNode {
1725         &self.syntax
1726     }
1727 }
1728 impl ast::AttrsOwner for MatchArmList {}
1729 impl MatchArmList {
1730     pub fn arms(&self) -> AstChildren<MatchArm> {
1731         AstChildren::new(&self.syntax)
1732     }
1733 }
1734 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1735 pub struct MatchExpr {
1736     pub(crate) syntax: SyntaxNode,
1737 }
1738 impl AstNode for MatchExpr {
1739     fn can_cast(kind: SyntaxKind) -> bool {
1740         match kind {
1741             MATCH_EXPR => true,
1742             _ => false,
1743         }
1744     }
1745     fn cast(syntax: SyntaxNode) -> Option<Self> {
1746         if Self::can_cast(syntax.kind()) {
1747             Some(Self { syntax })
1748         } else {
1749             None
1750         }
1751     }
1752     fn syntax(&self) -> &SyntaxNode {
1753         &self.syntax
1754     }
1755 }
1756 impl MatchExpr {
1757     pub fn expr(&self) -> Option<Expr> {
1758         AstChildren::new(&self.syntax).next()
1759     }
1760     pub fn match_arm_list(&self) -> Option<MatchArmList> {
1761         AstChildren::new(&self.syntax).next()
1762     }
1763 }
1764 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1765 pub struct MatchGuard {
1766     pub(crate) syntax: SyntaxNode,
1767 }
1768 impl AstNode for MatchGuard {
1769     fn can_cast(kind: SyntaxKind) -> bool {
1770         match kind {
1771             MATCH_GUARD => true,
1772             _ => false,
1773         }
1774     }
1775     fn cast(syntax: SyntaxNode) -> Option<Self> {
1776         if Self::can_cast(syntax.kind()) {
1777             Some(Self { syntax })
1778         } else {
1779             None
1780         }
1781     }
1782     fn syntax(&self) -> &SyntaxNode {
1783         &self.syntax
1784     }
1785 }
1786 impl MatchGuard {
1787     pub fn expr(&self) -> Option<Expr> {
1788         AstChildren::new(&self.syntax).next()
1789     }
1790 }
1791 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1792 pub struct MethodCallExpr {
1793     pub(crate) syntax: SyntaxNode,
1794 }
1795 impl AstNode for MethodCallExpr {
1796     fn can_cast(kind: SyntaxKind) -> bool {
1797         match kind {
1798             METHOD_CALL_EXPR => true,
1799             _ => false,
1800         }
1801     }
1802     fn cast(syntax: SyntaxNode) -> Option<Self> {
1803         if Self::can_cast(syntax.kind()) {
1804             Some(Self { syntax })
1805         } else {
1806             None
1807         }
1808     }
1809     fn syntax(&self) -> &SyntaxNode {
1810         &self.syntax
1811     }
1812 }
1813 impl ast::ArgListOwner for MethodCallExpr {}
1814 impl MethodCallExpr {
1815     pub fn expr(&self) -> Option<Expr> {
1816         AstChildren::new(&self.syntax).next()
1817     }
1818     pub fn name_ref(&self) -> Option<NameRef> {
1819         AstChildren::new(&self.syntax).next()
1820     }
1821     pub fn type_arg_list(&self) -> Option<TypeArgList> {
1822         AstChildren::new(&self.syntax).next()
1823     }
1824 }
1825 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1826 pub struct Module {
1827     pub(crate) syntax: SyntaxNode,
1828 }
1829 impl AstNode for Module {
1830     fn can_cast(kind: SyntaxKind) -> bool {
1831         match kind {
1832             MODULE => true,
1833             _ => false,
1834         }
1835     }
1836     fn cast(syntax: SyntaxNode) -> Option<Self> {
1837         if Self::can_cast(syntax.kind()) {
1838             Some(Self { syntax })
1839         } else {
1840             None
1841         }
1842     }
1843     fn syntax(&self) -> &SyntaxNode {
1844         &self.syntax
1845     }
1846 }
1847 impl ast::VisibilityOwner for Module {}
1848 impl ast::NameOwner for Module {}
1849 impl ast::AttrsOwner for Module {}
1850 impl ast::DocCommentsOwner for Module {}
1851 impl Module {
1852     pub fn item_list(&self) -> Option<ItemList> {
1853         AstChildren::new(&self.syntax).next()
1854     }
1855 }
1856 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1857 pub enum ModuleItem {
1858     StructDef(StructDef),
1859     EnumDef(EnumDef),
1860     FnDef(FnDef),
1861     TraitDef(TraitDef),
1862     TypeAliasDef(TypeAliasDef),
1863     ImplBlock(ImplBlock),
1864     UseItem(UseItem),
1865     ExternCrateItem(ExternCrateItem),
1866     ConstDef(ConstDef),
1867     StaticDef(StaticDef),
1868     Module(Module),
1869 }
1870 impl From<StructDef> for ModuleItem {
1871     fn from(node: StructDef) -> ModuleItem {
1872         ModuleItem::StructDef(node)
1873     }
1874 }
1875 impl From<EnumDef> for ModuleItem {
1876     fn from(node: EnumDef) -> ModuleItem {
1877         ModuleItem::EnumDef(node)
1878     }
1879 }
1880 impl From<FnDef> for ModuleItem {
1881     fn from(node: FnDef) -> ModuleItem {
1882         ModuleItem::FnDef(node)
1883     }
1884 }
1885 impl From<TraitDef> for ModuleItem {
1886     fn from(node: TraitDef) -> ModuleItem {
1887         ModuleItem::TraitDef(node)
1888     }
1889 }
1890 impl From<TypeAliasDef> for ModuleItem {
1891     fn from(node: TypeAliasDef) -> ModuleItem {
1892         ModuleItem::TypeAliasDef(node)
1893     }
1894 }
1895 impl From<ImplBlock> for ModuleItem {
1896     fn from(node: ImplBlock) -> ModuleItem {
1897         ModuleItem::ImplBlock(node)
1898     }
1899 }
1900 impl From<UseItem> for ModuleItem {
1901     fn from(node: UseItem) -> ModuleItem {
1902         ModuleItem::UseItem(node)
1903     }
1904 }
1905 impl From<ExternCrateItem> for ModuleItem {
1906     fn from(node: ExternCrateItem) -> ModuleItem {
1907         ModuleItem::ExternCrateItem(node)
1908     }
1909 }
1910 impl From<ConstDef> for ModuleItem {
1911     fn from(node: ConstDef) -> ModuleItem {
1912         ModuleItem::ConstDef(node)
1913     }
1914 }
1915 impl From<StaticDef> for ModuleItem {
1916     fn from(node: StaticDef) -> ModuleItem {
1917         ModuleItem::StaticDef(node)
1918     }
1919 }
1920 impl From<Module> for ModuleItem {
1921     fn from(node: Module) -> ModuleItem {
1922         ModuleItem::Module(node)
1923     }
1924 }
1925 impl AstNode for ModuleItem {
1926     fn can_cast(kind: SyntaxKind) -> bool {
1927         match kind {
1928             STRUCT_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_BLOCK | USE_ITEM
1929             | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true,
1930             _ => false,
1931         }
1932     }
1933     fn cast(syntax: SyntaxNode) -> Option<Self> {
1934         let res = match syntax.kind() {
1935             STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }),
1936             ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }),
1937             FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
1938             TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
1939             TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
1940             IMPL_BLOCK => ModuleItem::ImplBlock(ImplBlock { syntax }),
1941             USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
1942             EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
1943             CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
1944             STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }),
1945             MODULE => ModuleItem::Module(Module { syntax }),
1946             _ => return None,
1947         };
1948         Some(res)
1949     }
1950     fn syntax(&self) -> &SyntaxNode {
1951         match self {
1952             ModuleItem::StructDef(it) => &it.syntax,
1953             ModuleItem::EnumDef(it) => &it.syntax,
1954             ModuleItem::FnDef(it) => &it.syntax,
1955             ModuleItem::TraitDef(it) => &it.syntax,
1956             ModuleItem::TypeAliasDef(it) => &it.syntax,
1957             ModuleItem::ImplBlock(it) => &it.syntax,
1958             ModuleItem::UseItem(it) => &it.syntax,
1959             ModuleItem::ExternCrateItem(it) => &it.syntax,
1960             ModuleItem::ConstDef(it) => &it.syntax,
1961             ModuleItem::StaticDef(it) => &it.syntax,
1962             ModuleItem::Module(it) => &it.syntax,
1963         }
1964     }
1965 }
1966 impl ast::AttrsOwner for ModuleItem {}
1967 impl ModuleItem {}
1968 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1969 pub struct Name {
1970     pub(crate) syntax: SyntaxNode,
1971 }
1972 impl AstNode for Name {
1973     fn can_cast(kind: SyntaxKind) -> bool {
1974         match kind {
1975             NAME => true,
1976             _ => false,
1977         }
1978     }
1979     fn cast(syntax: SyntaxNode) -> Option<Self> {
1980         if Self::can_cast(syntax.kind()) {
1981             Some(Self { syntax })
1982         } else {
1983             None
1984         }
1985     }
1986     fn syntax(&self) -> &SyntaxNode {
1987         &self.syntax
1988     }
1989 }
1990 impl Name {}
1991 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1992 pub struct NameRef {
1993     pub(crate) syntax: SyntaxNode,
1994 }
1995 impl AstNode for NameRef {
1996     fn can_cast(kind: SyntaxKind) -> bool {
1997         match kind {
1998             NAME_REF => true,
1999             _ => false,
2000         }
2001     }
2002     fn cast(syntax: SyntaxNode) -> Option<Self> {
2003         if Self::can_cast(syntax.kind()) {
2004             Some(Self { syntax })
2005         } else {
2006             None
2007         }
2008     }
2009     fn syntax(&self) -> &SyntaxNode {
2010         &self.syntax
2011     }
2012 }
2013 impl NameRef {}
2014 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2015 pub struct NeverType {
2016     pub(crate) syntax: SyntaxNode,
2017 }
2018 impl AstNode for NeverType {
2019     fn can_cast(kind: SyntaxKind) -> bool {
2020         match kind {
2021             NEVER_TYPE => true,
2022             _ => false,
2023         }
2024     }
2025     fn cast(syntax: SyntaxNode) -> Option<Self> {
2026         if Self::can_cast(syntax.kind()) {
2027             Some(Self { syntax })
2028         } else {
2029             None
2030         }
2031     }
2032     fn syntax(&self) -> &SyntaxNode {
2033         &self.syntax
2034     }
2035 }
2036 impl NeverType {}
2037 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2038 pub enum NominalDef {
2039     StructDef(StructDef),
2040     EnumDef(EnumDef),
2041 }
2042 impl From<StructDef> for NominalDef {
2043     fn from(node: StructDef) -> NominalDef {
2044         NominalDef::StructDef(node)
2045     }
2046 }
2047 impl From<EnumDef> for NominalDef {
2048     fn from(node: EnumDef) -> NominalDef {
2049         NominalDef::EnumDef(node)
2050     }
2051 }
2052 impl AstNode for NominalDef {
2053     fn can_cast(kind: SyntaxKind) -> bool {
2054         match kind {
2055             STRUCT_DEF | ENUM_DEF => true,
2056             _ => false,
2057         }
2058     }
2059     fn cast(syntax: SyntaxNode) -> Option<Self> {
2060         let res = match syntax.kind() {
2061             STRUCT_DEF => NominalDef::StructDef(StructDef { syntax }),
2062             ENUM_DEF => NominalDef::EnumDef(EnumDef { syntax }),
2063             _ => return None,
2064         };
2065         Some(res)
2066     }
2067     fn syntax(&self) -> &SyntaxNode {
2068         match self {
2069             NominalDef::StructDef(it) => &it.syntax,
2070             NominalDef::EnumDef(it) => &it.syntax,
2071         }
2072     }
2073 }
2074 impl ast::NameOwner for NominalDef {}
2075 impl ast::TypeParamsOwner for NominalDef {}
2076 impl ast::AttrsOwner for NominalDef {}
2077 impl NominalDef {}
2078 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2079 pub struct Param {
2080     pub(crate) syntax: SyntaxNode,
2081 }
2082 impl AstNode for Param {
2083     fn can_cast(kind: SyntaxKind) -> bool {
2084         match kind {
2085             PARAM => true,
2086             _ => false,
2087         }
2088     }
2089     fn cast(syntax: SyntaxNode) -> Option<Self> {
2090         if Self::can_cast(syntax.kind()) {
2091             Some(Self { syntax })
2092         } else {
2093             None
2094         }
2095     }
2096     fn syntax(&self) -> &SyntaxNode {
2097         &self.syntax
2098     }
2099 }
2100 impl ast::TypeAscriptionOwner for Param {}
2101 impl ast::AttrsOwner for Param {}
2102 impl Param {
2103     pub fn pat(&self) -> Option<Pat> {
2104         AstChildren::new(&self.syntax).next()
2105     }
2106 }
2107 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2108 pub struct ParamList {
2109     pub(crate) syntax: SyntaxNode,
2110 }
2111 impl AstNode for ParamList {
2112     fn can_cast(kind: SyntaxKind) -> bool {
2113         match kind {
2114             PARAM_LIST => true,
2115             _ => false,
2116         }
2117     }
2118     fn cast(syntax: SyntaxNode) -> Option<Self> {
2119         if Self::can_cast(syntax.kind()) {
2120             Some(Self { syntax })
2121         } else {
2122             None
2123         }
2124     }
2125     fn syntax(&self) -> &SyntaxNode {
2126         &self.syntax
2127     }
2128 }
2129 impl ParamList {
2130     pub fn params(&self) -> AstChildren<Param> {
2131         AstChildren::new(&self.syntax)
2132     }
2133     pub fn self_param(&self) -> Option<SelfParam> {
2134         AstChildren::new(&self.syntax).next()
2135     }
2136 }
2137 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2138 pub struct ParenExpr {
2139     pub(crate) syntax: SyntaxNode,
2140 }
2141 impl AstNode for ParenExpr {
2142     fn can_cast(kind: SyntaxKind) -> bool {
2143         match kind {
2144             PAREN_EXPR => true,
2145             _ => false,
2146         }
2147     }
2148     fn cast(syntax: SyntaxNode) -> Option<Self> {
2149         if Self::can_cast(syntax.kind()) {
2150             Some(Self { syntax })
2151         } else {
2152             None
2153         }
2154     }
2155     fn syntax(&self) -> &SyntaxNode {
2156         &self.syntax
2157     }
2158 }
2159 impl ParenExpr {
2160     pub fn expr(&self) -> Option<Expr> {
2161         AstChildren::new(&self.syntax).next()
2162     }
2163 }
2164 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2165 pub struct ParenType {
2166     pub(crate) syntax: SyntaxNode,
2167 }
2168 impl AstNode for ParenType {
2169     fn can_cast(kind: SyntaxKind) -> bool {
2170         match kind {
2171             PAREN_TYPE => true,
2172             _ => false,
2173         }
2174     }
2175     fn cast(syntax: SyntaxNode) -> Option<Self> {
2176         if Self::can_cast(syntax.kind()) {
2177             Some(Self { syntax })
2178         } else {
2179             None
2180         }
2181     }
2182     fn syntax(&self) -> &SyntaxNode {
2183         &self.syntax
2184     }
2185 }
2186 impl ParenType {
2187     pub fn type_ref(&self) -> Option<TypeRef> {
2188         AstChildren::new(&self.syntax).next()
2189     }
2190 }
2191 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2192 pub enum Pat {
2193     RefPat(RefPat),
2194     BoxPat(BoxPat),
2195     BindPat(BindPat),
2196     PlaceholderPat(PlaceholderPat),
2197     DotDotPat(DotDotPat),
2198     PathPat(PathPat),
2199     RecordPat(RecordPat),
2200     TupleStructPat(TupleStructPat),
2201     TuplePat(TuplePat),
2202     SlicePat(SlicePat),
2203     RangePat(RangePat),
2204     LiteralPat(LiteralPat),
2205 }
2206 impl From<RefPat> for Pat {
2207     fn from(node: RefPat) -> Pat {
2208         Pat::RefPat(node)
2209     }
2210 }
2211 impl From<BoxPat> for Pat {
2212     fn from(node: BoxPat) -> Pat {
2213         Pat::BoxPat(node)
2214     }
2215 }
2216 impl From<BindPat> for Pat {
2217     fn from(node: BindPat) -> Pat {
2218         Pat::BindPat(node)
2219     }
2220 }
2221 impl From<PlaceholderPat> for Pat {
2222     fn from(node: PlaceholderPat) -> Pat {
2223         Pat::PlaceholderPat(node)
2224     }
2225 }
2226 impl From<DotDotPat> for Pat {
2227     fn from(node: DotDotPat) -> Pat {
2228         Pat::DotDotPat(node)
2229     }
2230 }
2231 impl From<PathPat> for Pat {
2232     fn from(node: PathPat) -> Pat {
2233         Pat::PathPat(node)
2234     }
2235 }
2236 impl From<RecordPat> for Pat {
2237     fn from(node: RecordPat) -> Pat {
2238         Pat::RecordPat(node)
2239     }
2240 }
2241 impl From<TupleStructPat> for Pat {
2242     fn from(node: TupleStructPat) -> Pat {
2243         Pat::TupleStructPat(node)
2244     }
2245 }
2246 impl From<TuplePat> for Pat {
2247     fn from(node: TuplePat) -> Pat {
2248         Pat::TuplePat(node)
2249     }
2250 }
2251 impl From<SlicePat> for Pat {
2252     fn from(node: SlicePat) -> Pat {
2253         Pat::SlicePat(node)
2254     }
2255 }
2256 impl From<RangePat> for Pat {
2257     fn from(node: RangePat) -> Pat {
2258         Pat::RangePat(node)
2259     }
2260 }
2261 impl From<LiteralPat> for Pat {
2262     fn from(node: LiteralPat) -> Pat {
2263         Pat::LiteralPat(node)
2264     }
2265 }
2266 impl AstNode for Pat {
2267     fn can_cast(kind: SyntaxKind) -> bool {
2268         match kind {
2269             REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | PATH_PAT
2270             | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => {
2271                 true
2272             }
2273             _ => false,
2274         }
2275     }
2276     fn cast(syntax: SyntaxNode) -> Option<Self> {
2277         let res = match syntax.kind() {
2278             REF_PAT => Pat::RefPat(RefPat { syntax }),
2279             BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
2280             BIND_PAT => Pat::BindPat(BindPat { syntax }),
2281             PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
2282             DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
2283             PATH_PAT => Pat::PathPat(PathPat { syntax }),
2284             RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
2285             TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
2286             TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
2287             SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
2288             RANGE_PAT => Pat::RangePat(RangePat { syntax }),
2289             LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
2290             _ => return None,
2291         };
2292         Some(res)
2293     }
2294     fn syntax(&self) -> &SyntaxNode {
2295         match self {
2296             Pat::RefPat(it) => &it.syntax,
2297             Pat::BoxPat(it) => &it.syntax,
2298             Pat::BindPat(it) => &it.syntax,
2299             Pat::PlaceholderPat(it) => &it.syntax,
2300             Pat::DotDotPat(it) => &it.syntax,
2301             Pat::PathPat(it) => &it.syntax,
2302             Pat::RecordPat(it) => &it.syntax,
2303             Pat::TupleStructPat(it) => &it.syntax,
2304             Pat::TuplePat(it) => &it.syntax,
2305             Pat::SlicePat(it) => &it.syntax,
2306             Pat::RangePat(it) => &it.syntax,
2307             Pat::LiteralPat(it) => &it.syntax,
2308         }
2309     }
2310 }
2311 impl Pat {}
2312 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2313 pub struct Path {
2314     pub(crate) syntax: SyntaxNode,
2315 }
2316 impl AstNode for Path {
2317     fn can_cast(kind: SyntaxKind) -> bool {
2318         match kind {
2319             PATH => true,
2320             _ => false,
2321         }
2322     }
2323     fn cast(syntax: SyntaxNode) -> Option<Self> {
2324         if Self::can_cast(syntax.kind()) {
2325             Some(Self { syntax })
2326         } else {
2327             None
2328         }
2329     }
2330     fn syntax(&self) -> &SyntaxNode {
2331         &self.syntax
2332     }
2333 }
2334 impl Path {
2335     pub fn segment(&self) -> Option<PathSegment> {
2336         AstChildren::new(&self.syntax).next()
2337     }
2338     pub fn qualifier(&self) -> Option<Path> {
2339         AstChildren::new(&self.syntax).next()
2340     }
2341 }
2342 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2343 pub struct PathExpr {
2344     pub(crate) syntax: SyntaxNode,
2345 }
2346 impl AstNode for PathExpr {
2347     fn can_cast(kind: SyntaxKind) -> bool {
2348         match kind {
2349             PATH_EXPR => true,
2350             _ => false,
2351         }
2352     }
2353     fn cast(syntax: SyntaxNode) -> Option<Self> {
2354         if Self::can_cast(syntax.kind()) {
2355             Some(Self { syntax })
2356         } else {
2357             None
2358         }
2359     }
2360     fn syntax(&self) -> &SyntaxNode {
2361         &self.syntax
2362     }
2363 }
2364 impl PathExpr {
2365     pub fn path(&self) -> Option<Path> {
2366         AstChildren::new(&self.syntax).next()
2367     }
2368 }
2369 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2370 pub struct PathPat {
2371     pub(crate) syntax: SyntaxNode,
2372 }
2373 impl AstNode for PathPat {
2374     fn can_cast(kind: SyntaxKind) -> bool {
2375         match kind {
2376             PATH_PAT => true,
2377             _ => false,
2378         }
2379     }
2380     fn cast(syntax: SyntaxNode) -> Option<Self> {
2381         if Self::can_cast(syntax.kind()) {
2382             Some(Self { syntax })
2383         } else {
2384             None
2385         }
2386     }
2387     fn syntax(&self) -> &SyntaxNode {
2388         &self.syntax
2389     }
2390 }
2391 impl PathPat {
2392     pub fn path(&self) -> Option<Path> {
2393         AstChildren::new(&self.syntax).next()
2394     }
2395 }
2396 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2397 pub struct PathSegment {
2398     pub(crate) syntax: SyntaxNode,
2399 }
2400 impl AstNode for PathSegment {
2401     fn can_cast(kind: SyntaxKind) -> bool {
2402         match kind {
2403             PATH_SEGMENT => true,
2404             _ => false,
2405         }
2406     }
2407     fn cast(syntax: SyntaxNode) -> Option<Self> {
2408         if Self::can_cast(syntax.kind()) {
2409             Some(Self { syntax })
2410         } else {
2411             None
2412         }
2413     }
2414     fn syntax(&self) -> &SyntaxNode {
2415         &self.syntax
2416     }
2417 }
2418 impl PathSegment {
2419     pub fn name_ref(&self) -> Option<NameRef> {
2420         AstChildren::new(&self.syntax).next()
2421     }
2422     pub fn type_arg_list(&self) -> Option<TypeArgList> {
2423         AstChildren::new(&self.syntax).next()
2424     }
2425     pub fn param_list(&self) -> Option<ParamList> {
2426         AstChildren::new(&self.syntax).next()
2427     }
2428     pub fn ret_type(&self) -> Option<RetType> {
2429         AstChildren::new(&self.syntax).next()
2430     }
2431     pub fn path_type(&self) -> Option<PathType> {
2432         AstChildren::new(&self.syntax).next()
2433     }
2434 }
2435 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2436 pub struct PathType {
2437     pub(crate) syntax: SyntaxNode,
2438 }
2439 impl AstNode for PathType {
2440     fn can_cast(kind: SyntaxKind) -> bool {
2441         match kind {
2442             PATH_TYPE => true,
2443             _ => false,
2444         }
2445     }
2446     fn cast(syntax: SyntaxNode) -> Option<Self> {
2447         if Self::can_cast(syntax.kind()) {
2448             Some(Self { syntax })
2449         } else {
2450             None
2451         }
2452     }
2453     fn syntax(&self) -> &SyntaxNode {
2454         &self.syntax
2455     }
2456 }
2457 impl PathType {
2458     pub fn path(&self) -> Option<Path> {
2459         AstChildren::new(&self.syntax).next()
2460     }
2461 }
2462 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2463 pub struct PlaceholderPat {
2464     pub(crate) syntax: SyntaxNode,
2465 }
2466 impl AstNode for PlaceholderPat {
2467     fn can_cast(kind: SyntaxKind) -> bool {
2468         match kind {
2469             PLACEHOLDER_PAT => true,
2470             _ => false,
2471         }
2472     }
2473     fn cast(syntax: SyntaxNode) -> Option<Self> {
2474         if Self::can_cast(syntax.kind()) {
2475             Some(Self { syntax })
2476         } else {
2477             None
2478         }
2479     }
2480     fn syntax(&self) -> &SyntaxNode {
2481         &self.syntax
2482     }
2483 }
2484 impl PlaceholderPat {}
2485 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2486 pub struct PlaceholderType {
2487     pub(crate) syntax: SyntaxNode,
2488 }
2489 impl AstNode for PlaceholderType {
2490     fn can_cast(kind: SyntaxKind) -> bool {
2491         match kind {
2492             PLACEHOLDER_TYPE => true,
2493             _ => false,
2494         }
2495     }
2496     fn cast(syntax: SyntaxNode) -> Option<Self> {
2497         if Self::can_cast(syntax.kind()) {
2498             Some(Self { syntax })
2499         } else {
2500             None
2501         }
2502     }
2503     fn syntax(&self) -> &SyntaxNode {
2504         &self.syntax
2505     }
2506 }
2507 impl PlaceholderType {}
2508 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2509 pub struct PointerType {
2510     pub(crate) syntax: SyntaxNode,
2511 }
2512 impl AstNode for PointerType {
2513     fn can_cast(kind: SyntaxKind) -> bool {
2514         match kind {
2515             POINTER_TYPE => true,
2516             _ => false,
2517         }
2518     }
2519     fn cast(syntax: SyntaxNode) -> Option<Self> {
2520         if Self::can_cast(syntax.kind()) {
2521             Some(Self { syntax })
2522         } else {
2523             None
2524         }
2525     }
2526     fn syntax(&self) -> &SyntaxNode {
2527         &self.syntax
2528     }
2529 }
2530 impl PointerType {
2531     pub fn type_ref(&self) -> Option<TypeRef> {
2532         AstChildren::new(&self.syntax).next()
2533     }
2534 }
2535 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2536 pub struct PrefixExpr {
2537     pub(crate) syntax: SyntaxNode,
2538 }
2539 impl AstNode for PrefixExpr {
2540     fn can_cast(kind: SyntaxKind) -> bool {
2541         match kind {
2542             PREFIX_EXPR => true,
2543             _ => false,
2544         }
2545     }
2546     fn cast(syntax: SyntaxNode) -> Option<Self> {
2547         if Self::can_cast(syntax.kind()) {
2548             Some(Self { syntax })
2549         } else {
2550             None
2551         }
2552     }
2553     fn syntax(&self) -> &SyntaxNode {
2554         &self.syntax
2555     }
2556 }
2557 impl PrefixExpr {
2558     pub fn expr(&self) -> Option<Expr> {
2559         AstChildren::new(&self.syntax).next()
2560     }
2561 }
2562 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2563 pub struct RangeExpr {
2564     pub(crate) syntax: SyntaxNode,
2565 }
2566 impl AstNode for RangeExpr {
2567     fn can_cast(kind: SyntaxKind) -> bool {
2568         match kind {
2569             RANGE_EXPR => true,
2570             _ => false,
2571         }
2572     }
2573     fn cast(syntax: SyntaxNode) -> Option<Self> {
2574         if Self::can_cast(syntax.kind()) {
2575             Some(Self { syntax })
2576         } else {
2577             None
2578         }
2579     }
2580     fn syntax(&self) -> &SyntaxNode {
2581         &self.syntax
2582     }
2583 }
2584 impl RangeExpr {}
2585 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2586 pub struct RangePat {
2587     pub(crate) syntax: SyntaxNode,
2588 }
2589 impl AstNode for RangePat {
2590     fn can_cast(kind: SyntaxKind) -> bool {
2591         match kind {
2592             RANGE_PAT => true,
2593             _ => false,
2594         }
2595     }
2596     fn cast(syntax: SyntaxNode) -> Option<Self> {
2597         if Self::can_cast(syntax.kind()) {
2598             Some(Self { syntax })
2599         } else {
2600             None
2601         }
2602     }
2603     fn syntax(&self) -> &SyntaxNode {
2604         &self.syntax
2605     }
2606 }
2607 impl RangePat {}
2608 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2609 pub struct RecordField {
2610     pub(crate) syntax: SyntaxNode,
2611 }
2612 impl AstNode for RecordField {
2613     fn can_cast(kind: SyntaxKind) -> bool {
2614         match kind {
2615             RECORD_FIELD => true,
2616             _ => false,
2617         }
2618     }
2619     fn cast(syntax: SyntaxNode) -> Option<Self> {
2620         if Self::can_cast(syntax.kind()) {
2621             Some(Self { syntax })
2622         } else {
2623             None
2624         }
2625     }
2626     fn syntax(&self) -> &SyntaxNode {
2627         &self.syntax
2628     }
2629 }
2630 impl RecordField {
2631     pub fn name_ref(&self) -> Option<NameRef> {
2632         AstChildren::new(&self.syntax).next()
2633     }
2634     pub fn expr(&self) -> Option<Expr> {
2635         AstChildren::new(&self.syntax).next()
2636     }
2637 }
2638 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2639 pub struct RecordFieldDef {
2640     pub(crate) syntax: SyntaxNode,
2641 }
2642 impl AstNode for RecordFieldDef {
2643     fn can_cast(kind: SyntaxKind) -> bool {
2644         match kind {
2645             RECORD_FIELD_DEF => true,
2646             _ => false,
2647         }
2648     }
2649     fn cast(syntax: SyntaxNode) -> Option<Self> {
2650         if Self::can_cast(syntax.kind()) {
2651             Some(Self { syntax })
2652         } else {
2653             None
2654         }
2655     }
2656     fn syntax(&self) -> &SyntaxNode {
2657         &self.syntax
2658     }
2659 }
2660 impl ast::VisibilityOwner for RecordFieldDef {}
2661 impl ast::NameOwner for RecordFieldDef {}
2662 impl ast::AttrsOwner for RecordFieldDef {}
2663 impl ast::DocCommentsOwner for RecordFieldDef {}
2664 impl ast::TypeAscriptionOwner for RecordFieldDef {}
2665 impl RecordFieldDef {}
2666 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2667 pub struct RecordFieldDefList {
2668     pub(crate) syntax: SyntaxNode,
2669 }
2670 impl AstNode for RecordFieldDefList {
2671     fn can_cast(kind: SyntaxKind) -> bool {
2672         match kind {
2673             RECORD_FIELD_DEF_LIST => true,
2674             _ => false,
2675         }
2676     }
2677     fn cast(syntax: SyntaxNode) -> Option<Self> {
2678         if Self::can_cast(syntax.kind()) {
2679             Some(Self { syntax })
2680         } else {
2681             None
2682         }
2683     }
2684     fn syntax(&self) -> &SyntaxNode {
2685         &self.syntax
2686     }
2687 }
2688 impl RecordFieldDefList {
2689     pub fn fields(&self) -> AstChildren<RecordFieldDef> {
2690         AstChildren::new(&self.syntax)
2691     }
2692 }
2693 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2694 pub struct RecordFieldList {
2695     pub(crate) syntax: SyntaxNode,
2696 }
2697 impl AstNode for RecordFieldList {
2698     fn can_cast(kind: SyntaxKind) -> bool {
2699         match kind {
2700             RECORD_FIELD_LIST => true,
2701             _ => false,
2702         }
2703     }
2704     fn cast(syntax: SyntaxNode) -> Option<Self> {
2705         if Self::can_cast(syntax.kind()) {
2706             Some(Self { syntax })
2707         } else {
2708             None
2709         }
2710     }
2711     fn syntax(&self) -> &SyntaxNode {
2712         &self.syntax
2713     }
2714 }
2715 impl RecordFieldList {
2716     pub fn fields(&self) -> AstChildren<RecordField> {
2717         AstChildren::new(&self.syntax)
2718     }
2719     pub fn spread(&self) -> Option<Expr> {
2720         AstChildren::new(&self.syntax).next()
2721     }
2722 }
2723 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2724 pub struct RecordFieldPat {
2725     pub(crate) syntax: SyntaxNode,
2726 }
2727 impl AstNode for RecordFieldPat {
2728     fn can_cast(kind: SyntaxKind) -> bool {
2729         match kind {
2730             RECORD_FIELD_PAT => true,
2731             _ => false,
2732         }
2733     }
2734     fn cast(syntax: SyntaxNode) -> Option<Self> {
2735         if Self::can_cast(syntax.kind()) {
2736             Some(Self { syntax })
2737         } else {
2738             None
2739         }
2740     }
2741     fn syntax(&self) -> &SyntaxNode {
2742         &self.syntax
2743     }
2744 }
2745 impl ast::NameOwner for RecordFieldPat {}
2746 impl RecordFieldPat {
2747     pub fn pat(&self) -> Option<Pat> {
2748         AstChildren::new(&self.syntax).next()
2749     }
2750 }
2751 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2752 pub struct RecordFieldPatList {
2753     pub(crate) syntax: SyntaxNode,
2754 }
2755 impl AstNode for RecordFieldPatList {
2756     fn can_cast(kind: SyntaxKind) -> bool {
2757         match kind {
2758             RECORD_FIELD_PAT_LIST => true,
2759             _ => false,
2760         }
2761     }
2762     fn cast(syntax: SyntaxNode) -> Option<Self> {
2763         if Self::can_cast(syntax.kind()) {
2764             Some(Self { syntax })
2765         } else {
2766             None
2767         }
2768     }
2769     fn syntax(&self) -> &SyntaxNode {
2770         &self.syntax
2771     }
2772 }
2773 impl RecordFieldPatList {
2774     pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
2775         AstChildren::new(&self.syntax)
2776     }
2777     pub fn bind_pats(&self) -> AstChildren<BindPat> {
2778         AstChildren::new(&self.syntax)
2779     }
2780 }
2781 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2782 pub struct RecordLit {
2783     pub(crate) syntax: SyntaxNode,
2784 }
2785 impl AstNode for RecordLit {
2786     fn can_cast(kind: SyntaxKind) -> bool {
2787         match kind {
2788             RECORD_LIT => true,
2789             _ => false,
2790         }
2791     }
2792     fn cast(syntax: SyntaxNode) -> Option<Self> {
2793         if Self::can_cast(syntax.kind()) {
2794             Some(Self { syntax })
2795         } else {
2796             None
2797         }
2798     }
2799     fn syntax(&self) -> &SyntaxNode {
2800         &self.syntax
2801     }
2802 }
2803 impl RecordLit {
2804     pub fn path(&self) -> Option<Path> {
2805         AstChildren::new(&self.syntax).next()
2806     }
2807     pub fn record_field_list(&self) -> Option<RecordFieldList> {
2808         AstChildren::new(&self.syntax).next()
2809     }
2810 }
2811 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2812 pub struct RecordPat {
2813     pub(crate) syntax: SyntaxNode,
2814 }
2815 impl AstNode for RecordPat {
2816     fn can_cast(kind: SyntaxKind) -> bool {
2817         match kind {
2818             RECORD_PAT => true,
2819             _ => false,
2820         }
2821     }
2822     fn cast(syntax: SyntaxNode) -> Option<Self> {
2823         if Self::can_cast(syntax.kind()) {
2824             Some(Self { syntax })
2825         } else {
2826             None
2827         }
2828     }
2829     fn syntax(&self) -> &SyntaxNode {
2830         &self.syntax
2831     }
2832 }
2833 impl RecordPat {
2834     pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
2835         AstChildren::new(&self.syntax).next()
2836     }
2837     pub fn path(&self) -> Option<Path> {
2838         AstChildren::new(&self.syntax).next()
2839     }
2840 }
2841 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2842 pub struct RefExpr {
2843     pub(crate) syntax: SyntaxNode,
2844 }
2845 impl AstNode for RefExpr {
2846     fn can_cast(kind: SyntaxKind) -> bool {
2847         match kind {
2848             REF_EXPR => true,
2849             _ => false,
2850         }
2851     }
2852     fn cast(syntax: SyntaxNode) -> Option<Self> {
2853         if Self::can_cast(syntax.kind()) {
2854             Some(Self { syntax })
2855         } else {
2856             None
2857         }
2858     }
2859     fn syntax(&self) -> &SyntaxNode {
2860         &self.syntax
2861     }
2862 }
2863 impl RefExpr {
2864     pub fn expr(&self) -> Option<Expr> {
2865         AstChildren::new(&self.syntax).next()
2866     }
2867 }
2868 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2869 pub struct RefPat {
2870     pub(crate) syntax: SyntaxNode,
2871 }
2872 impl AstNode for RefPat {
2873     fn can_cast(kind: SyntaxKind) -> bool {
2874         match kind {
2875             REF_PAT => true,
2876             _ => false,
2877         }
2878     }
2879     fn cast(syntax: SyntaxNode) -> Option<Self> {
2880         if Self::can_cast(syntax.kind()) {
2881             Some(Self { syntax })
2882         } else {
2883             None
2884         }
2885     }
2886     fn syntax(&self) -> &SyntaxNode {
2887         &self.syntax
2888     }
2889 }
2890 impl RefPat {
2891     pub fn pat(&self) -> Option<Pat> {
2892         AstChildren::new(&self.syntax).next()
2893     }
2894 }
2895 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2896 pub struct ReferenceType {
2897     pub(crate) syntax: SyntaxNode,
2898 }
2899 impl AstNode for ReferenceType {
2900     fn can_cast(kind: SyntaxKind) -> bool {
2901         match kind {
2902             REFERENCE_TYPE => true,
2903             _ => false,
2904         }
2905     }
2906     fn cast(syntax: SyntaxNode) -> Option<Self> {
2907         if Self::can_cast(syntax.kind()) {
2908             Some(Self { syntax })
2909         } else {
2910             None
2911         }
2912     }
2913     fn syntax(&self) -> &SyntaxNode {
2914         &self.syntax
2915     }
2916 }
2917 impl ReferenceType {
2918     pub fn type_ref(&self) -> Option<TypeRef> {
2919         AstChildren::new(&self.syntax).next()
2920     }
2921 }
2922 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2923 pub struct RetType {
2924     pub(crate) syntax: SyntaxNode,
2925 }
2926 impl AstNode for RetType {
2927     fn can_cast(kind: SyntaxKind) -> bool {
2928         match kind {
2929             RET_TYPE => true,
2930             _ => false,
2931         }
2932     }
2933     fn cast(syntax: SyntaxNode) -> Option<Self> {
2934         if Self::can_cast(syntax.kind()) {
2935             Some(Self { syntax })
2936         } else {
2937             None
2938         }
2939     }
2940     fn syntax(&self) -> &SyntaxNode {
2941         &self.syntax
2942     }
2943 }
2944 impl RetType {
2945     pub fn type_ref(&self) -> Option<TypeRef> {
2946         AstChildren::new(&self.syntax).next()
2947     }
2948 }
2949 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2950 pub struct ReturnExpr {
2951     pub(crate) syntax: SyntaxNode,
2952 }
2953 impl AstNode for ReturnExpr {
2954     fn can_cast(kind: SyntaxKind) -> bool {
2955         match kind {
2956             RETURN_EXPR => true,
2957             _ => false,
2958         }
2959     }
2960     fn cast(syntax: SyntaxNode) -> Option<Self> {
2961         if Self::can_cast(syntax.kind()) {
2962             Some(Self { syntax })
2963         } else {
2964             None
2965         }
2966     }
2967     fn syntax(&self) -> &SyntaxNode {
2968         &self.syntax
2969     }
2970 }
2971 impl ReturnExpr {
2972     pub fn expr(&self) -> Option<Expr> {
2973         AstChildren::new(&self.syntax).next()
2974     }
2975 }
2976 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2977 pub struct SelfParam {
2978     pub(crate) syntax: SyntaxNode,
2979 }
2980 impl AstNode for SelfParam {
2981     fn can_cast(kind: SyntaxKind) -> bool {
2982         match kind {
2983             SELF_PARAM => true,
2984             _ => false,
2985         }
2986     }
2987     fn cast(syntax: SyntaxNode) -> Option<Self> {
2988         if Self::can_cast(syntax.kind()) {
2989             Some(Self { syntax })
2990         } else {
2991             None
2992         }
2993     }
2994     fn syntax(&self) -> &SyntaxNode {
2995         &self.syntax
2996     }
2997 }
2998 impl ast::TypeAscriptionOwner for SelfParam {}
2999 impl ast::AttrsOwner for SelfParam {}
3000 impl SelfParam {}
3001 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3002 pub struct SlicePat {
3003     pub(crate) syntax: SyntaxNode,
3004 }
3005 impl AstNode for SlicePat {
3006     fn can_cast(kind: SyntaxKind) -> bool {
3007         match kind {
3008             SLICE_PAT => true,
3009             _ => false,
3010         }
3011     }
3012     fn cast(syntax: SyntaxNode) -> Option<Self> {
3013         if Self::can_cast(syntax.kind()) {
3014             Some(Self { syntax })
3015         } else {
3016             None
3017         }
3018     }
3019     fn syntax(&self) -> &SyntaxNode {
3020         &self.syntax
3021     }
3022 }
3023 impl SlicePat {}
3024 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3025 pub struct SliceType {
3026     pub(crate) syntax: SyntaxNode,
3027 }
3028 impl AstNode for SliceType {
3029     fn can_cast(kind: SyntaxKind) -> bool {
3030         match kind {
3031             SLICE_TYPE => true,
3032             _ => false,
3033         }
3034     }
3035     fn cast(syntax: SyntaxNode) -> Option<Self> {
3036         if Self::can_cast(syntax.kind()) {
3037             Some(Self { syntax })
3038         } else {
3039             None
3040         }
3041     }
3042     fn syntax(&self) -> &SyntaxNode {
3043         &self.syntax
3044     }
3045 }
3046 impl SliceType {
3047     pub fn type_ref(&self) -> Option<TypeRef> {
3048         AstChildren::new(&self.syntax).next()
3049     }
3050 }
3051 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3052 pub struct SourceFile {
3053     pub(crate) syntax: SyntaxNode,
3054 }
3055 impl AstNode for SourceFile {
3056     fn can_cast(kind: SyntaxKind) -> bool {
3057         match kind {
3058             SOURCE_FILE => true,
3059             _ => false,
3060         }
3061     }
3062     fn cast(syntax: SyntaxNode) -> Option<Self> {
3063         if Self::can_cast(syntax.kind()) {
3064             Some(Self { syntax })
3065         } else {
3066             None
3067         }
3068     }
3069     fn syntax(&self) -> &SyntaxNode {
3070         &self.syntax
3071     }
3072 }
3073 impl ast::ModuleItemOwner for SourceFile {}
3074 impl ast::FnDefOwner for SourceFile {}
3075 impl SourceFile {
3076     pub fn modules(&self) -> AstChildren<Module> {
3077         AstChildren::new(&self.syntax)
3078     }
3079 }
3080 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3081 pub struct StaticDef {
3082     pub(crate) syntax: SyntaxNode,
3083 }
3084 impl AstNode for StaticDef {
3085     fn can_cast(kind: SyntaxKind) -> bool {
3086         match kind {
3087             STATIC_DEF => true,
3088             _ => false,
3089         }
3090     }
3091     fn cast(syntax: SyntaxNode) -> Option<Self> {
3092         if Self::can_cast(syntax.kind()) {
3093             Some(Self { syntax })
3094         } else {
3095             None
3096         }
3097     }
3098     fn syntax(&self) -> &SyntaxNode {
3099         &self.syntax
3100     }
3101 }
3102 impl ast::VisibilityOwner for StaticDef {}
3103 impl ast::NameOwner for StaticDef {}
3104 impl ast::TypeParamsOwner for StaticDef {}
3105 impl ast::AttrsOwner for StaticDef {}
3106 impl ast::DocCommentsOwner for StaticDef {}
3107 impl ast::TypeAscriptionOwner for StaticDef {}
3108 impl StaticDef {
3109     pub fn body(&self) -> Option<Expr> {
3110         AstChildren::new(&self.syntax).next()
3111     }
3112 }
3113 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3114 pub enum Stmt {
3115     ExprStmt(ExprStmt),
3116     LetStmt(LetStmt),
3117 }
3118 impl From<ExprStmt> for Stmt {
3119     fn from(node: ExprStmt) -> Stmt {
3120         Stmt::ExprStmt(node)
3121     }
3122 }
3123 impl From<LetStmt> for Stmt {
3124     fn from(node: LetStmt) -> Stmt {
3125         Stmt::LetStmt(node)
3126     }
3127 }
3128 impl AstNode for Stmt {
3129     fn can_cast(kind: SyntaxKind) -> bool {
3130         match kind {
3131             EXPR_STMT | LET_STMT => true,
3132             _ => false,
3133         }
3134     }
3135     fn cast(syntax: SyntaxNode) -> Option<Self> {
3136         let res = match syntax.kind() {
3137             EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
3138             LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
3139             _ => return None,
3140         };
3141         Some(res)
3142     }
3143     fn syntax(&self) -> &SyntaxNode {
3144         match self {
3145             Stmt::ExprStmt(it) => &it.syntax,
3146             Stmt::LetStmt(it) => &it.syntax,
3147         }
3148     }
3149 }
3150 impl Stmt {}
3151 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3152 pub struct StructDef {
3153     pub(crate) syntax: SyntaxNode,
3154 }
3155 impl AstNode for StructDef {
3156     fn can_cast(kind: SyntaxKind) -> bool {
3157         match kind {
3158             STRUCT_DEF => true,
3159             _ => false,
3160         }
3161     }
3162     fn cast(syntax: SyntaxNode) -> Option<Self> {
3163         if Self::can_cast(syntax.kind()) {
3164             Some(Self { syntax })
3165         } else {
3166             None
3167         }
3168     }
3169     fn syntax(&self) -> &SyntaxNode {
3170         &self.syntax
3171     }
3172 }
3173 impl ast::VisibilityOwner for StructDef {}
3174 impl ast::NameOwner for StructDef {}
3175 impl ast::TypeParamsOwner for StructDef {}
3176 impl ast::AttrsOwner for StructDef {}
3177 impl ast::DocCommentsOwner for StructDef {}
3178 impl StructDef {}
3179 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3180 pub struct TokenTree {
3181     pub(crate) syntax: SyntaxNode,
3182 }
3183 impl AstNode for TokenTree {
3184     fn can_cast(kind: SyntaxKind) -> bool {
3185         match kind {
3186             TOKEN_TREE => true,
3187             _ => false,
3188         }
3189     }
3190     fn cast(syntax: SyntaxNode) -> Option<Self> {
3191         if Self::can_cast(syntax.kind()) {
3192             Some(Self { syntax })
3193         } else {
3194             None
3195         }
3196     }
3197     fn syntax(&self) -> &SyntaxNode {
3198         &self.syntax
3199     }
3200 }
3201 impl TokenTree {}
3202 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3203 pub struct TraitDef {
3204     pub(crate) syntax: SyntaxNode,
3205 }
3206 impl AstNode for TraitDef {
3207     fn can_cast(kind: SyntaxKind) -> bool {
3208         match kind {
3209             TRAIT_DEF => true,
3210             _ => false,
3211         }
3212     }
3213     fn cast(syntax: SyntaxNode) -> Option<Self> {
3214         if Self::can_cast(syntax.kind()) {
3215             Some(Self { syntax })
3216         } else {
3217             None
3218         }
3219     }
3220     fn syntax(&self) -> &SyntaxNode {
3221         &self.syntax
3222     }
3223 }
3224 impl ast::VisibilityOwner for TraitDef {}
3225 impl ast::NameOwner for TraitDef {}
3226 impl ast::AttrsOwner for TraitDef {}
3227 impl ast::DocCommentsOwner for TraitDef {}
3228 impl ast::TypeParamsOwner for TraitDef {}
3229 impl ast::TypeBoundsOwner for TraitDef {}
3230 impl TraitDef {
3231     pub fn item_list(&self) -> Option<ItemList> {
3232         AstChildren::new(&self.syntax).next()
3233     }
3234 }
3235 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3236 pub struct TryBlockExpr {
3237     pub(crate) syntax: SyntaxNode,
3238 }
3239 impl AstNode for TryBlockExpr {
3240     fn can_cast(kind: SyntaxKind) -> bool {
3241         match kind {
3242             TRY_BLOCK_EXPR => true,
3243             _ => false,
3244         }
3245     }
3246     fn cast(syntax: SyntaxNode) -> Option<Self> {
3247         if Self::can_cast(syntax.kind()) {
3248             Some(Self { syntax })
3249         } else {
3250             None
3251         }
3252     }
3253     fn syntax(&self) -> &SyntaxNode {
3254         &self.syntax
3255     }
3256 }
3257 impl TryBlockExpr {
3258     pub fn body(&self) -> Option<BlockExpr> {
3259         AstChildren::new(&self.syntax).next()
3260     }
3261 }
3262 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3263 pub struct TryExpr {
3264     pub(crate) syntax: SyntaxNode,
3265 }
3266 impl AstNode for TryExpr {
3267     fn can_cast(kind: SyntaxKind) -> bool {
3268         match kind {
3269             TRY_EXPR => true,
3270             _ => false,
3271         }
3272     }
3273     fn cast(syntax: SyntaxNode) -> Option<Self> {
3274         if Self::can_cast(syntax.kind()) {
3275             Some(Self { syntax })
3276         } else {
3277             None
3278         }
3279     }
3280     fn syntax(&self) -> &SyntaxNode {
3281         &self.syntax
3282     }
3283 }
3284 impl TryExpr {
3285     pub fn expr(&self) -> Option<Expr> {
3286         AstChildren::new(&self.syntax).next()
3287     }
3288 }
3289 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3290 pub struct TupleExpr {
3291     pub(crate) syntax: SyntaxNode,
3292 }
3293 impl AstNode for TupleExpr {
3294     fn can_cast(kind: SyntaxKind) -> bool {
3295         match kind {
3296             TUPLE_EXPR => true,
3297             _ => false,
3298         }
3299     }
3300     fn cast(syntax: SyntaxNode) -> Option<Self> {
3301         if Self::can_cast(syntax.kind()) {
3302             Some(Self { syntax })
3303         } else {
3304             None
3305         }
3306     }
3307     fn syntax(&self) -> &SyntaxNode {
3308         &self.syntax
3309     }
3310 }
3311 impl TupleExpr {
3312     pub fn exprs(&self) -> AstChildren<Expr> {
3313         AstChildren::new(&self.syntax)
3314     }
3315 }
3316 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3317 pub struct TupleFieldDef {
3318     pub(crate) syntax: SyntaxNode,
3319 }
3320 impl AstNode for TupleFieldDef {
3321     fn can_cast(kind: SyntaxKind) -> bool {
3322         match kind {
3323             TUPLE_FIELD_DEF => true,
3324             _ => false,
3325         }
3326     }
3327     fn cast(syntax: SyntaxNode) -> Option<Self> {
3328         if Self::can_cast(syntax.kind()) {
3329             Some(Self { syntax })
3330         } else {
3331             None
3332         }
3333     }
3334     fn syntax(&self) -> &SyntaxNode {
3335         &self.syntax
3336     }
3337 }
3338 impl ast::VisibilityOwner for TupleFieldDef {}
3339 impl ast::AttrsOwner for TupleFieldDef {}
3340 impl TupleFieldDef {
3341     pub fn type_ref(&self) -> Option<TypeRef> {
3342         AstChildren::new(&self.syntax).next()
3343     }
3344 }
3345 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3346 pub struct TupleFieldDefList {
3347     pub(crate) syntax: SyntaxNode,
3348 }
3349 impl AstNode for TupleFieldDefList {
3350     fn can_cast(kind: SyntaxKind) -> bool {
3351         match kind {
3352             TUPLE_FIELD_DEF_LIST => true,
3353             _ => false,
3354         }
3355     }
3356     fn cast(syntax: SyntaxNode) -> Option<Self> {
3357         if Self::can_cast(syntax.kind()) {
3358             Some(Self { syntax })
3359         } else {
3360             None
3361         }
3362     }
3363     fn syntax(&self) -> &SyntaxNode {
3364         &self.syntax
3365     }
3366 }
3367 impl TupleFieldDefList {
3368     pub fn fields(&self) -> AstChildren<TupleFieldDef> {
3369         AstChildren::new(&self.syntax)
3370     }
3371 }
3372 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3373 pub struct TuplePat {
3374     pub(crate) syntax: SyntaxNode,
3375 }
3376 impl AstNode for TuplePat {
3377     fn can_cast(kind: SyntaxKind) -> bool {
3378         match kind {
3379             TUPLE_PAT => true,
3380             _ => false,
3381         }
3382     }
3383     fn cast(syntax: SyntaxNode) -> Option<Self> {
3384         if Self::can_cast(syntax.kind()) {
3385             Some(Self { syntax })
3386         } else {
3387             None
3388         }
3389     }
3390     fn syntax(&self) -> &SyntaxNode {
3391         &self.syntax
3392     }
3393 }
3394 impl TuplePat {
3395     pub fn args(&self) -> AstChildren<Pat> {
3396         AstChildren::new(&self.syntax)
3397     }
3398 }
3399 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3400 pub struct TupleStructPat {
3401     pub(crate) syntax: SyntaxNode,
3402 }
3403 impl AstNode for TupleStructPat {
3404     fn can_cast(kind: SyntaxKind) -> bool {
3405         match kind {
3406             TUPLE_STRUCT_PAT => true,
3407             _ => false,
3408         }
3409     }
3410     fn cast(syntax: SyntaxNode) -> Option<Self> {
3411         if Self::can_cast(syntax.kind()) {
3412             Some(Self { syntax })
3413         } else {
3414             None
3415         }
3416     }
3417     fn syntax(&self) -> &SyntaxNode {
3418         &self.syntax
3419     }
3420 }
3421 impl TupleStructPat {
3422     pub fn args(&self) -> AstChildren<Pat> {
3423         AstChildren::new(&self.syntax)
3424     }
3425     pub fn path(&self) -> Option<Path> {
3426         AstChildren::new(&self.syntax).next()
3427     }
3428 }
3429 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3430 pub struct TupleType {
3431     pub(crate) syntax: SyntaxNode,
3432 }
3433 impl AstNode for TupleType {
3434     fn can_cast(kind: SyntaxKind) -> bool {
3435         match kind {
3436             TUPLE_TYPE => true,
3437             _ => false,
3438         }
3439     }
3440     fn cast(syntax: SyntaxNode) -> Option<Self> {
3441         if Self::can_cast(syntax.kind()) {
3442             Some(Self { syntax })
3443         } else {
3444             None
3445         }
3446     }
3447     fn syntax(&self) -> &SyntaxNode {
3448         &self.syntax
3449     }
3450 }
3451 impl TupleType {
3452     pub fn fields(&self) -> AstChildren<TypeRef> {
3453         AstChildren::new(&self.syntax)
3454     }
3455 }
3456 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3457 pub struct TypeAliasDef {
3458     pub(crate) syntax: SyntaxNode,
3459 }
3460 impl AstNode for TypeAliasDef {
3461     fn can_cast(kind: SyntaxKind) -> bool {
3462         match kind {
3463             TYPE_ALIAS_DEF => true,
3464             _ => false,
3465         }
3466     }
3467     fn cast(syntax: SyntaxNode) -> Option<Self> {
3468         if Self::can_cast(syntax.kind()) {
3469             Some(Self { syntax })
3470         } else {
3471             None
3472         }
3473     }
3474     fn syntax(&self) -> &SyntaxNode {
3475         &self.syntax
3476     }
3477 }
3478 impl ast::VisibilityOwner for TypeAliasDef {}
3479 impl ast::NameOwner for TypeAliasDef {}
3480 impl ast::TypeParamsOwner for TypeAliasDef {}
3481 impl ast::AttrsOwner for TypeAliasDef {}
3482 impl ast::DocCommentsOwner for TypeAliasDef {}
3483 impl ast::TypeBoundsOwner for TypeAliasDef {}
3484 impl TypeAliasDef {
3485     pub fn type_ref(&self) -> Option<TypeRef> {
3486         AstChildren::new(&self.syntax).next()
3487     }
3488 }
3489 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3490 pub struct TypeArg {
3491     pub(crate) syntax: SyntaxNode,
3492 }
3493 impl AstNode for TypeArg {
3494     fn can_cast(kind: SyntaxKind) -> bool {
3495         match kind {
3496             TYPE_ARG => true,
3497             _ => false,
3498         }
3499     }
3500     fn cast(syntax: SyntaxNode) -> Option<Self> {
3501         if Self::can_cast(syntax.kind()) {
3502             Some(Self { syntax })
3503         } else {
3504             None
3505         }
3506     }
3507     fn syntax(&self) -> &SyntaxNode {
3508         &self.syntax
3509     }
3510 }
3511 impl TypeArg {
3512     pub fn type_ref(&self) -> Option<TypeRef> {
3513         AstChildren::new(&self.syntax).next()
3514     }
3515 }
3516 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3517 pub struct TypeArgList {
3518     pub(crate) syntax: SyntaxNode,
3519 }
3520 impl AstNode for TypeArgList {
3521     fn can_cast(kind: SyntaxKind) -> bool {
3522         match kind {
3523             TYPE_ARG_LIST => true,
3524             _ => false,
3525         }
3526     }
3527     fn cast(syntax: SyntaxNode) -> Option<Self> {
3528         if Self::can_cast(syntax.kind()) {
3529             Some(Self { syntax })
3530         } else {
3531             None
3532         }
3533     }
3534     fn syntax(&self) -> &SyntaxNode {
3535         &self.syntax
3536     }
3537 }
3538 impl TypeArgList {
3539     pub fn type_args(&self) -> AstChildren<TypeArg> {
3540         AstChildren::new(&self.syntax)
3541     }
3542     pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> {
3543         AstChildren::new(&self.syntax)
3544     }
3545     pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> {
3546         AstChildren::new(&self.syntax)
3547     }
3548 }
3549 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3550 pub struct TypeBound {
3551     pub(crate) syntax: SyntaxNode,
3552 }
3553 impl AstNode for TypeBound {
3554     fn can_cast(kind: SyntaxKind) -> bool {
3555         match kind {
3556             TYPE_BOUND => true,
3557             _ => false,
3558         }
3559     }
3560     fn cast(syntax: SyntaxNode) -> Option<Self> {
3561         if Self::can_cast(syntax.kind()) {
3562             Some(Self { syntax })
3563         } else {
3564             None
3565         }
3566     }
3567     fn syntax(&self) -> &SyntaxNode {
3568         &self.syntax
3569     }
3570 }
3571 impl TypeBound {
3572     pub fn type_ref(&self) -> Option<TypeRef> {
3573         AstChildren::new(&self.syntax).next()
3574     }
3575 }
3576 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3577 pub struct TypeBoundList {
3578     pub(crate) syntax: SyntaxNode,
3579 }
3580 impl AstNode for TypeBoundList {
3581     fn can_cast(kind: SyntaxKind) -> bool {
3582         match kind {
3583             TYPE_BOUND_LIST => true,
3584             _ => false,
3585         }
3586     }
3587     fn cast(syntax: SyntaxNode) -> Option<Self> {
3588         if Self::can_cast(syntax.kind()) {
3589             Some(Self { syntax })
3590         } else {
3591             None
3592         }
3593     }
3594     fn syntax(&self) -> &SyntaxNode {
3595         &self.syntax
3596     }
3597 }
3598 impl TypeBoundList {
3599     pub fn bounds(&self) -> AstChildren<TypeBound> {
3600         AstChildren::new(&self.syntax)
3601     }
3602 }
3603 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3604 pub struct TypeParam {
3605     pub(crate) syntax: SyntaxNode,
3606 }
3607 impl AstNode for TypeParam {
3608     fn can_cast(kind: SyntaxKind) -> bool {
3609         match kind {
3610             TYPE_PARAM => true,
3611             _ => false,
3612         }
3613     }
3614     fn cast(syntax: SyntaxNode) -> Option<Self> {
3615         if Self::can_cast(syntax.kind()) {
3616             Some(Self { syntax })
3617         } else {
3618             None
3619         }
3620     }
3621     fn syntax(&self) -> &SyntaxNode {
3622         &self.syntax
3623     }
3624 }
3625 impl ast::NameOwner for TypeParam {}
3626 impl ast::AttrsOwner for TypeParam {}
3627 impl ast::TypeBoundsOwner for TypeParam {}
3628 impl TypeParam {
3629     pub fn default_type(&self) -> Option<TypeRef> {
3630         AstChildren::new(&self.syntax).next()
3631     }
3632 }
3633 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3634 pub struct TypeParamList {
3635     pub(crate) syntax: SyntaxNode,
3636 }
3637 impl AstNode for TypeParamList {
3638     fn can_cast(kind: SyntaxKind) -> bool {
3639         match kind {
3640             TYPE_PARAM_LIST => true,
3641             _ => false,
3642         }
3643     }
3644     fn cast(syntax: SyntaxNode) -> Option<Self> {
3645         if Self::can_cast(syntax.kind()) {
3646             Some(Self { syntax })
3647         } else {
3648             None
3649         }
3650     }
3651     fn syntax(&self) -> &SyntaxNode {
3652         &self.syntax
3653     }
3654 }
3655 impl TypeParamList {
3656     pub fn type_params(&self) -> AstChildren<TypeParam> {
3657         AstChildren::new(&self.syntax)
3658     }
3659     pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> {
3660         AstChildren::new(&self.syntax)
3661     }
3662 }
3663 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3664 pub enum TypeRef {
3665     ParenType(ParenType),
3666     TupleType(TupleType),
3667     NeverType(NeverType),
3668     PathType(PathType),
3669     PointerType(PointerType),
3670     ArrayType(ArrayType),
3671     SliceType(SliceType),
3672     ReferenceType(ReferenceType),
3673     PlaceholderType(PlaceholderType),
3674     FnPointerType(FnPointerType),
3675     ForType(ForType),
3676     ImplTraitType(ImplTraitType),
3677     DynTraitType(DynTraitType),
3678 }
3679 impl From<ParenType> for TypeRef {
3680     fn from(node: ParenType) -> TypeRef {
3681         TypeRef::ParenType(node)
3682     }
3683 }
3684 impl From<TupleType> for TypeRef {
3685     fn from(node: TupleType) -> TypeRef {
3686         TypeRef::TupleType(node)
3687     }
3688 }
3689 impl From<NeverType> for TypeRef {
3690     fn from(node: NeverType) -> TypeRef {
3691         TypeRef::NeverType(node)
3692     }
3693 }
3694 impl From<PathType> for TypeRef {
3695     fn from(node: PathType) -> TypeRef {
3696         TypeRef::PathType(node)
3697     }
3698 }
3699 impl From<PointerType> for TypeRef {
3700     fn from(node: PointerType) -> TypeRef {
3701         TypeRef::PointerType(node)
3702     }
3703 }
3704 impl From<ArrayType> for TypeRef {
3705     fn from(node: ArrayType) -> TypeRef {
3706         TypeRef::ArrayType(node)
3707     }
3708 }
3709 impl From<SliceType> for TypeRef {
3710     fn from(node: SliceType) -> TypeRef {
3711         TypeRef::SliceType(node)
3712     }
3713 }
3714 impl From<ReferenceType> for TypeRef {
3715     fn from(node: ReferenceType) -> TypeRef {
3716         TypeRef::ReferenceType(node)
3717     }
3718 }
3719 impl From<PlaceholderType> for TypeRef {
3720     fn from(node: PlaceholderType) -> TypeRef {
3721         TypeRef::PlaceholderType(node)
3722     }
3723 }
3724 impl From<FnPointerType> for TypeRef {
3725     fn from(node: FnPointerType) -> TypeRef {
3726         TypeRef::FnPointerType(node)
3727     }
3728 }
3729 impl From<ForType> for TypeRef {
3730     fn from(node: ForType) -> TypeRef {
3731         TypeRef::ForType(node)
3732     }
3733 }
3734 impl From<ImplTraitType> for TypeRef {
3735     fn from(node: ImplTraitType) -> TypeRef {
3736         TypeRef::ImplTraitType(node)
3737     }
3738 }
3739 impl From<DynTraitType> for TypeRef {
3740     fn from(node: DynTraitType) -> TypeRef {
3741         TypeRef::DynTraitType(node)
3742     }
3743 }
3744 impl AstNode for TypeRef {
3745     fn can_cast(kind: SyntaxKind) -> bool {
3746         match kind {
3747             PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
3748             | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE
3749             | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
3750             _ => false,
3751         }
3752     }
3753     fn cast(syntax: SyntaxNode) -> Option<Self> {
3754         let res = match syntax.kind() {
3755             PAREN_TYPE => TypeRef::ParenType(ParenType { syntax }),
3756             TUPLE_TYPE => TypeRef::TupleType(TupleType { syntax }),
3757             NEVER_TYPE => TypeRef::NeverType(NeverType { syntax }),
3758             PATH_TYPE => TypeRef::PathType(PathType { syntax }),
3759             POINTER_TYPE => TypeRef::PointerType(PointerType { syntax }),
3760             ARRAY_TYPE => TypeRef::ArrayType(ArrayType { syntax }),
3761             SLICE_TYPE => TypeRef::SliceType(SliceType { syntax }),
3762             REFERENCE_TYPE => TypeRef::ReferenceType(ReferenceType { syntax }),
3763             PLACEHOLDER_TYPE => TypeRef::PlaceholderType(PlaceholderType { syntax }),
3764             FN_POINTER_TYPE => TypeRef::FnPointerType(FnPointerType { syntax }),
3765             FOR_TYPE => TypeRef::ForType(ForType { syntax }),
3766             IMPL_TRAIT_TYPE => TypeRef::ImplTraitType(ImplTraitType { syntax }),
3767             DYN_TRAIT_TYPE => TypeRef::DynTraitType(DynTraitType { syntax }),
3768             _ => return None,
3769         };
3770         Some(res)
3771     }
3772     fn syntax(&self) -> &SyntaxNode {
3773         match self {
3774             TypeRef::ParenType(it) => &it.syntax,
3775             TypeRef::TupleType(it) => &it.syntax,
3776             TypeRef::NeverType(it) => &it.syntax,
3777             TypeRef::PathType(it) => &it.syntax,
3778             TypeRef::PointerType(it) => &it.syntax,
3779             TypeRef::ArrayType(it) => &it.syntax,
3780             TypeRef::SliceType(it) => &it.syntax,
3781             TypeRef::ReferenceType(it) => &it.syntax,
3782             TypeRef::PlaceholderType(it) => &it.syntax,
3783             TypeRef::FnPointerType(it) => &it.syntax,
3784             TypeRef::ForType(it) => &it.syntax,
3785             TypeRef::ImplTraitType(it) => &it.syntax,
3786             TypeRef::DynTraitType(it) => &it.syntax,
3787         }
3788     }
3789 }
3790 impl TypeRef {}
3791 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3792 pub struct UnionDef {
3793     pub(crate) syntax: SyntaxNode,
3794 }
3795 impl AstNode for UnionDef {
3796     fn can_cast(kind: SyntaxKind) -> bool {
3797         match kind {
3798             UNION_DEF => true,
3799             _ => false,
3800         }
3801     }
3802     fn cast(syntax: SyntaxNode) -> Option<Self> {
3803         if Self::can_cast(syntax.kind()) {
3804             Some(Self { syntax })
3805         } else {
3806             None
3807         }
3808     }
3809     fn syntax(&self) -> &SyntaxNode {
3810         &self.syntax
3811     }
3812 }
3813 impl ast::VisibilityOwner for UnionDef {}
3814 impl ast::NameOwner for UnionDef {}
3815 impl ast::TypeParamsOwner for UnionDef {}
3816 impl ast::AttrsOwner for UnionDef {}
3817 impl ast::DocCommentsOwner for UnionDef {}
3818 impl UnionDef {}
3819 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3820 pub struct UseItem {
3821     pub(crate) syntax: SyntaxNode,
3822 }
3823 impl AstNode for UseItem {
3824     fn can_cast(kind: SyntaxKind) -> bool {
3825         match kind {
3826             USE_ITEM => true,
3827             _ => false,
3828         }
3829     }
3830     fn cast(syntax: SyntaxNode) -> Option<Self> {
3831         if Self::can_cast(syntax.kind()) {
3832             Some(Self { syntax })
3833         } else {
3834             None
3835         }
3836     }
3837     fn syntax(&self) -> &SyntaxNode {
3838         &self.syntax
3839     }
3840 }
3841 impl ast::AttrsOwner for UseItem {}
3842 impl UseItem {
3843     pub fn use_tree(&self) -> Option<UseTree> {
3844         AstChildren::new(&self.syntax).next()
3845     }
3846 }
3847 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3848 pub struct UseTree {
3849     pub(crate) syntax: SyntaxNode,
3850 }
3851 impl AstNode for UseTree {
3852     fn can_cast(kind: SyntaxKind) -> bool {
3853         match kind {
3854             USE_TREE => true,
3855             _ => false,
3856         }
3857     }
3858     fn cast(syntax: SyntaxNode) -> Option<Self> {
3859         if Self::can_cast(syntax.kind()) {
3860             Some(Self { syntax })
3861         } else {
3862             None
3863         }
3864     }
3865     fn syntax(&self) -> &SyntaxNode {
3866         &self.syntax
3867     }
3868 }
3869 impl UseTree {
3870     pub fn path(&self) -> Option<Path> {
3871         AstChildren::new(&self.syntax).next()
3872     }
3873     pub fn use_tree_list(&self) -> Option<UseTreeList> {
3874         AstChildren::new(&self.syntax).next()
3875     }
3876     pub fn alias(&self) -> Option<Alias> {
3877         AstChildren::new(&self.syntax).next()
3878     }
3879 }
3880 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3881 pub struct UseTreeList {
3882     pub(crate) syntax: SyntaxNode,
3883 }
3884 impl AstNode for UseTreeList {
3885     fn can_cast(kind: SyntaxKind) -> bool {
3886         match kind {
3887             USE_TREE_LIST => true,
3888             _ => false,
3889         }
3890     }
3891     fn cast(syntax: SyntaxNode) -> Option<Self> {
3892         if Self::can_cast(syntax.kind()) {
3893             Some(Self { syntax })
3894         } else {
3895             None
3896         }
3897     }
3898     fn syntax(&self) -> &SyntaxNode {
3899         &self.syntax
3900     }
3901 }
3902 impl UseTreeList {
3903     pub fn use_trees(&self) -> AstChildren<UseTree> {
3904         AstChildren::new(&self.syntax)
3905     }
3906 }
3907 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3908 pub struct Visibility {
3909     pub(crate) syntax: SyntaxNode,
3910 }
3911 impl AstNode for Visibility {
3912     fn can_cast(kind: SyntaxKind) -> bool {
3913         match kind {
3914             VISIBILITY => true,
3915             _ => false,
3916         }
3917     }
3918     fn cast(syntax: SyntaxNode) -> Option<Self> {
3919         if Self::can_cast(syntax.kind()) {
3920             Some(Self { syntax })
3921         } else {
3922             None
3923         }
3924     }
3925     fn syntax(&self) -> &SyntaxNode {
3926         &self.syntax
3927     }
3928 }
3929 impl Visibility {}
3930 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3931 pub struct WhereClause {
3932     pub(crate) syntax: SyntaxNode,
3933 }
3934 impl AstNode for WhereClause {
3935     fn can_cast(kind: SyntaxKind) -> bool {
3936         match kind {
3937             WHERE_CLAUSE => true,
3938             _ => false,
3939         }
3940     }
3941     fn cast(syntax: SyntaxNode) -> Option<Self> {
3942         if Self::can_cast(syntax.kind()) {
3943             Some(Self { syntax })
3944         } else {
3945             None
3946         }
3947     }
3948     fn syntax(&self) -> &SyntaxNode {
3949         &self.syntax
3950     }
3951 }
3952 impl WhereClause {
3953     pub fn predicates(&self) -> AstChildren<WherePred> {
3954         AstChildren::new(&self.syntax)
3955     }
3956 }
3957 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3958 pub struct WherePred {
3959     pub(crate) syntax: SyntaxNode,
3960 }
3961 impl AstNode for WherePred {
3962     fn can_cast(kind: SyntaxKind) -> bool {
3963         match kind {
3964             WHERE_PRED => true,
3965             _ => false,
3966         }
3967     }
3968     fn cast(syntax: SyntaxNode) -> Option<Self> {
3969         if Self::can_cast(syntax.kind()) {
3970             Some(Self { syntax })
3971         } else {
3972             None
3973         }
3974     }
3975     fn syntax(&self) -> &SyntaxNode {
3976         &self.syntax
3977     }
3978 }
3979 impl ast::TypeBoundsOwner for WherePred {}
3980 impl WherePred {
3981     pub fn type_ref(&self) -> Option<TypeRef> {
3982         AstChildren::new(&self.syntax).next()
3983     }
3984 }
3985 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3986 pub struct WhileExpr {
3987     pub(crate) syntax: SyntaxNode,
3988 }
3989 impl AstNode for WhileExpr {
3990     fn can_cast(kind: SyntaxKind) -> bool {
3991         match kind {
3992             WHILE_EXPR => true,
3993             _ => false,
3994         }
3995     }
3996     fn cast(syntax: SyntaxNode) -> Option<Self> {
3997         if Self::can_cast(syntax.kind()) {
3998             Some(Self { syntax })
3999         } else {
4000             None
4001         }
4002     }
4003     fn syntax(&self) -> &SyntaxNode {
4004         &self.syntax
4005     }
4006 }
4007 impl ast::LoopBodyOwner for WhileExpr {}
4008 impl WhileExpr {
4009     pub fn condition(&self) -> Option<Condition> {
4010         AstChildren::new(&self.syntax).next()
4011     }
4012 }