]> git.lizzy.rs Git - rust.git/blob - crates/ra_syntax/src/ast/generated.rs
Merge #1937
[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 ImplItem {}
1302 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1303 pub struct ImplTraitType {
1304     pub(crate) syntax: SyntaxNode,
1305 }
1306 impl AstNode for ImplTraitType {
1307     fn can_cast(kind: SyntaxKind) -> bool {
1308         match kind {
1309             IMPL_TRAIT_TYPE => true,
1310             _ => false,
1311         }
1312     }
1313     fn cast(syntax: SyntaxNode) -> Option<Self> {
1314         if Self::can_cast(syntax.kind()) {
1315             Some(Self { syntax })
1316         } else {
1317             None
1318         }
1319     }
1320     fn syntax(&self) -> &SyntaxNode {
1321         &self.syntax
1322     }
1323 }
1324 impl ast::TypeBoundsOwner for ImplTraitType {}
1325 impl ImplTraitType {}
1326 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1327 pub struct IndexExpr {
1328     pub(crate) syntax: SyntaxNode,
1329 }
1330 impl AstNode for IndexExpr {
1331     fn can_cast(kind: SyntaxKind) -> bool {
1332         match kind {
1333             INDEX_EXPR => true,
1334             _ => false,
1335         }
1336     }
1337     fn cast(syntax: SyntaxNode) -> Option<Self> {
1338         if Self::can_cast(syntax.kind()) {
1339             Some(Self { syntax })
1340         } else {
1341             None
1342         }
1343     }
1344     fn syntax(&self) -> &SyntaxNode {
1345         &self.syntax
1346     }
1347 }
1348 impl IndexExpr {}
1349 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1350 pub struct ItemList {
1351     pub(crate) syntax: SyntaxNode,
1352 }
1353 impl AstNode for ItemList {
1354     fn can_cast(kind: SyntaxKind) -> bool {
1355         match kind {
1356             ITEM_LIST => true,
1357             _ => false,
1358         }
1359     }
1360     fn cast(syntax: SyntaxNode) -> Option<Self> {
1361         if Self::can_cast(syntax.kind()) {
1362             Some(Self { syntax })
1363         } else {
1364             None
1365         }
1366     }
1367     fn syntax(&self) -> &SyntaxNode {
1368         &self.syntax
1369     }
1370 }
1371 impl ast::FnDefOwner for ItemList {}
1372 impl ast::ModuleItemOwner for ItemList {}
1373 impl ItemList {
1374     pub fn impl_items(&self) -> AstChildren<ImplItem> {
1375         AstChildren::new(&self.syntax)
1376     }
1377 }
1378 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1379 pub struct Label {
1380     pub(crate) syntax: SyntaxNode,
1381 }
1382 impl AstNode for Label {
1383     fn can_cast(kind: SyntaxKind) -> bool {
1384         match kind {
1385             LABEL => true,
1386             _ => false,
1387         }
1388     }
1389     fn cast(syntax: SyntaxNode) -> Option<Self> {
1390         if Self::can_cast(syntax.kind()) {
1391             Some(Self { syntax })
1392         } else {
1393             None
1394         }
1395     }
1396     fn syntax(&self) -> &SyntaxNode {
1397         &self.syntax
1398     }
1399 }
1400 impl Label {}
1401 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1402 pub struct LambdaExpr {
1403     pub(crate) syntax: SyntaxNode,
1404 }
1405 impl AstNode for LambdaExpr {
1406     fn can_cast(kind: SyntaxKind) -> bool {
1407         match kind {
1408             LAMBDA_EXPR => true,
1409             _ => false,
1410         }
1411     }
1412     fn cast(syntax: SyntaxNode) -> Option<Self> {
1413         if Self::can_cast(syntax.kind()) {
1414             Some(Self { syntax })
1415         } else {
1416             None
1417         }
1418     }
1419     fn syntax(&self) -> &SyntaxNode {
1420         &self.syntax
1421     }
1422 }
1423 impl LambdaExpr {
1424     pub fn param_list(&self) -> Option<ParamList> {
1425         AstChildren::new(&self.syntax).next()
1426     }
1427     pub fn body(&self) -> Option<Expr> {
1428         AstChildren::new(&self.syntax).next()
1429     }
1430 }
1431 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1432 pub struct LetStmt {
1433     pub(crate) syntax: SyntaxNode,
1434 }
1435 impl AstNode for LetStmt {
1436     fn can_cast(kind: SyntaxKind) -> bool {
1437         match kind {
1438             LET_STMT => true,
1439             _ => false,
1440         }
1441     }
1442     fn cast(syntax: SyntaxNode) -> Option<Self> {
1443         if Self::can_cast(syntax.kind()) {
1444             Some(Self { syntax })
1445         } else {
1446             None
1447         }
1448     }
1449     fn syntax(&self) -> &SyntaxNode {
1450         &self.syntax
1451     }
1452 }
1453 impl ast::TypeAscriptionOwner for LetStmt {}
1454 impl LetStmt {
1455     pub fn pat(&self) -> Option<Pat> {
1456         AstChildren::new(&self.syntax).next()
1457     }
1458     pub fn initializer(&self) -> Option<Expr> {
1459         AstChildren::new(&self.syntax).next()
1460     }
1461 }
1462 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1463 pub struct LifetimeArg {
1464     pub(crate) syntax: SyntaxNode,
1465 }
1466 impl AstNode for LifetimeArg {
1467     fn can_cast(kind: SyntaxKind) -> bool {
1468         match kind {
1469             LIFETIME_ARG => true,
1470             _ => false,
1471         }
1472     }
1473     fn cast(syntax: SyntaxNode) -> Option<Self> {
1474         if Self::can_cast(syntax.kind()) {
1475             Some(Self { syntax })
1476         } else {
1477             None
1478         }
1479     }
1480     fn syntax(&self) -> &SyntaxNode {
1481         &self.syntax
1482     }
1483 }
1484 impl LifetimeArg {}
1485 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1486 pub struct LifetimeParam {
1487     pub(crate) syntax: SyntaxNode,
1488 }
1489 impl AstNode for LifetimeParam {
1490     fn can_cast(kind: SyntaxKind) -> bool {
1491         match kind {
1492             LIFETIME_PARAM => true,
1493             _ => false,
1494         }
1495     }
1496     fn cast(syntax: SyntaxNode) -> Option<Self> {
1497         if Self::can_cast(syntax.kind()) {
1498             Some(Self { syntax })
1499         } else {
1500             None
1501         }
1502     }
1503     fn syntax(&self) -> &SyntaxNode {
1504         &self.syntax
1505     }
1506 }
1507 impl ast::AttrsOwner for LifetimeParam {}
1508 impl LifetimeParam {}
1509 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1510 pub struct Literal {
1511     pub(crate) syntax: SyntaxNode,
1512 }
1513 impl AstNode for Literal {
1514     fn can_cast(kind: SyntaxKind) -> bool {
1515         match kind {
1516             LITERAL => true,
1517             _ => false,
1518         }
1519     }
1520     fn cast(syntax: SyntaxNode) -> Option<Self> {
1521         if Self::can_cast(syntax.kind()) {
1522             Some(Self { syntax })
1523         } else {
1524             None
1525         }
1526     }
1527     fn syntax(&self) -> &SyntaxNode {
1528         &self.syntax
1529     }
1530 }
1531 impl Literal {}
1532 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1533 pub struct LiteralPat {
1534     pub(crate) syntax: SyntaxNode,
1535 }
1536 impl AstNode for LiteralPat {
1537     fn can_cast(kind: SyntaxKind) -> bool {
1538         match kind {
1539             LITERAL_PAT => true,
1540             _ => false,
1541         }
1542     }
1543     fn cast(syntax: SyntaxNode) -> Option<Self> {
1544         if Self::can_cast(syntax.kind()) {
1545             Some(Self { syntax })
1546         } else {
1547             None
1548         }
1549     }
1550     fn syntax(&self) -> &SyntaxNode {
1551         &self.syntax
1552     }
1553 }
1554 impl LiteralPat {
1555     pub fn literal(&self) -> Option<Literal> {
1556         AstChildren::new(&self.syntax).next()
1557     }
1558 }
1559 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1560 pub struct LoopExpr {
1561     pub(crate) syntax: SyntaxNode,
1562 }
1563 impl AstNode for LoopExpr {
1564     fn can_cast(kind: SyntaxKind) -> bool {
1565         match kind {
1566             LOOP_EXPR => true,
1567             _ => false,
1568         }
1569     }
1570     fn cast(syntax: SyntaxNode) -> Option<Self> {
1571         if Self::can_cast(syntax.kind()) {
1572             Some(Self { syntax })
1573         } else {
1574             None
1575         }
1576     }
1577     fn syntax(&self) -> &SyntaxNode {
1578         &self.syntax
1579     }
1580 }
1581 impl ast::LoopBodyOwner for LoopExpr {}
1582 impl LoopExpr {}
1583 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1584 pub struct MacroCall {
1585     pub(crate) syntax: SyntaxNode,
1586 }
1587 impl AstNode for MacroCall {
1588     fn can_cast(kind: SyntaxKind) -> bool {
1589         match kind {
1590             MACRO_CALL => true,
1591             _ => false,
1592         }
1593     }
1594     fn cast(syntax: SyntaxNode) -> Option<Self> {
1595         if Self::can_cast(syntax.kind()) {
1596             Some(Self { syntax })
1597         } else {
1598             None
1599         }
1600     }
1601     fn syntax(&self) -> &SyntaxNode {
1602         &self.syntax
1603     }
1604 }
1605 impl ast::NameOwner for MacroCall {}
1606 impl ast::AttrsOwner for MacroCall {}
1607 impl ast::DocCommentsOwner for MacroCall {}
1608 impl MacroCall {
1609     pub fn token_tree(&self) -> Option<TokenTree> {
1610         AstChildren::new(&self.syntax).next()
1611     }
1612     pub fn path(&self) -> Option<Path> {
1613         AstChildren::new(&self.syntax).next()
1614     }
1615 }
1616 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1617 pub struct MacroItems {
1618     pub(crate) syntax: SyntaxNode,
1619 }
1620 impl AstNode for MacroItems {
1621     fn can_cast(kind: SyntaxKind) -> bool {
1622         match kind {
1623             MACRO_ITEMS => true,
1624             _ => false,
1625         }
1626     }
1627     fn cast(syntax: SyntaxNode) -> Option<Self> {
1628         if Self::can_cast(syntax.kind()) {
1629             Some(Self { syntax })
1630         } else {
1631             None
1632         }
1633     }
1634     fn syntax(&self) -> &SyntaxNode {
1635         &self.syntax
1636     }
1637 }
1638 impl ast::ModuleItemOwner for MacroItems {}
1639 impl ast::FnDefOwner for MacroItems {}
1640 impl MacroItems {}
1641 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1642 pub struct MacroStmts {
1643     pub(crate) syntax: SyntaxNode,
1644 }
1645 impl AstNode for MacroStmts {
1646     fn can_cast(kind: SyntaxKind) -> bool {
1647         match kind {
1648             MACRO_STMTS => true,
1649             _ => false,
1650         }
1651     }
1652     fn cast(syntax: SyntaxNode) -> Option<Self> {
1653         if Self::can_cast(syntax.kind()) {
1654             Some(Self { syntax })
1655         } else {
1656             None
1657         }
1658     }
1659     fn syntax(&self) -> &SyntaxNode {
1660         &self.syntax
1661     }
1662 }
1663 impl MacroStmts {
1664     pub fn statements(&self) -> AstChildren<Stmt> {
1665         AstChildren::new(&self.syntax)
1666     }
1667     pub fn expr(&self) -> Option<Expr> {
1668         AstChildren::new(&self.syntax).next()
1669     }
1670 }
1671 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1672 pub struct MatchArm {
1673     pub(crate) syntax: SyntaxNode,
1674 }
1675 impl AstNode for MatchArm {
1676     fn can_cast(kind: SyntaxKind) -> bool {
1677         match kind {
1678             MATCH_ARM => true,
1679             _ => false,
1680         }
1681     }
1682     fn cast(syntax: SyntaxNode) -> Option<Self> {
1683         if Self::can_cast(syntax.kind()) {
1684             Some(Self { syntax })
1685         } else {
1686             None
1687         }
1688     }
1689     fn syntax(&self) -> &SyntaxNode {
1690         &self.syntax
1691     }
1692 }
1693 impl ast::AttrsOwner for MatchArm {}
1694 impl MatchArm {
1695     pub fn pats(&self) -> AstChildren<Pat> {
1696         AstChildren::new(&self.syntax)
1697     }
1698     pub fn guard(&self) -> Option<MatchGuard> {
1699         AstChildren::new(&self.syntax).next()
1700     }
1701     pub fn expr(&self) -> Option<Expr> {
1702         AstChildren::new(&self.syntax).next()
1703     }
1704 }
1705 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1706 pub struct MatchArmList {
1707     pub(crate) syntax: SyntaxNode,
1708 }
1709 impl AstNode for MatchArmList {
1710     fn can_cast(kind: SyntaxKind) -> bool {
1711         match kind {
1712             MATCH_ARM_LIST => true,
1713             _ => false,
1714         }
1715     }
1716     fn cast(syntax: SyntaxNode) -> Option<Self> {
1717         if Self::can_cast(syntax.kind()) {
1718             Some(Self { syntax })
1719         } else {
1720             None
1721         }
1722     }
1723     fn syntax(&self) -> &SyntaxNode {
1724         &self.syntax
1725     }
1726 }
1727 impl ast::AttrsOwner for MatchArmList {}
1728 impl MatchArmList {
1729     pub fn arms(&self) -> AstChildren<MatchArm> {
1730         AstChildren::new(&self.syntax)
1731     }
1732 }
1733 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1734 pub struct MatchExpr {
1735     pub(crate) syntax: SyntaxNode,
1736 }
1737 impl AstNode for MatchExpr {
1738     fn can_cast(kind: SyntaxKind) -> bool {
1739         match kind {
1740             MATCH_EXPR => true,
1741             _ => false,
1742         }
1743     }
1744     fn cast(syntax: SyntaxNode) -> Option<Self> {
1745         if Self::can_cast(syntax.kind()) {
1746             Some(Self { syntax })
1747         } else {
1748             None
1749         }
1750     }
1751     fn syntax(&self) -> &SyntaxNode {
1752         &self.syntax
1753     }
1754 }
1755 impl MatchExpr {
1756     pub fn expr(&self) -> Option<Expr> {
1757         AstChildren::new(&self.syntax).next()
1758     }
1759     pub fn match_arm_list(&self) -> Option<MatchArmList> {
1760         AstChildren::new(&self.syntax).next()
1761     }
1762 }
1763 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1764 pub struct MatchGuard {
1765     pub(crate) syntax: SyntaxNode,
1766 }
1767 impl AstNode for MatchGuard {
1768     fn can_cast(kind: SyntaxKind) -> bool {
1769         match kind {
1770             MATCH_GUARD => true,
1771             _ => false,
1772         }
1773     }
1774     fn cast(syntax: SyntaxNode) -> Option<Self> {
1775         if Self::can_cast(syntax.kind()) {
1776             Some(Self { syntax })
1777         } else {
1778             None
1779         }
1780     }
1781     fn syntax(&self) -> &SyntaxNode {
1782         &self.syntax
1783     }
1784 }
1785 impl MatchGuard {
1786     pub fn expr(&self) -> Option<Expr> {
1787         AstChildren::new(&self.syntax).next()
1788     }
1789 }
1790 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1791 pub struct MethodCallExpr {
1792     pub(crate) syntax: SyntaxNode,
1793 }
1794 impl AstNode for MethodCallExpr {
1795     fn can_cast(kind: SyntaxKind) -> bool {
1796         match kind {
1797             METHOD_CALL_EXPR => true,
1798             _ => false,
1799         }
1800     }
1801     fn cast(syntax: SyntaxNode) -> Option<Self> {
1802         if Self::can_cast(syntax.kind()) {
1803             Some(Self { syntax })
1804         } else {
1805             None
1806         }
1807     }
1808     fn syntax(&self) -> &SyntaxNode {
1809         &self.syntax
1810     }
1811 }
1812 impl ast::ArgListOwner for MethodCallExpr {}
1813 impl MethodCallExpr {
1814     pub fn expr(&self) -> Option<Expr> {
1815         AstChildren::new(&self.syntax).next()
1816     }
1817     pub fn name_ref(&self) -> Option<NameRef> {
1818         AstChildren::new(&self.syntax).next()
1819     }
1820     pub fn type_arg_list(&self) -> Option<TypeArgList> {
1821         AstChildren::new(&self.syntax).next()
1822     }
1823 }
1824 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1825 pub struct Module {
1826     pub(crate) syntax: SyntaxNode,
1827 }
1828 impl AstNode for Module {
1829     fn can_cast(kind: SyntaxKind) -> bool {
1830         match kind {
1831             MODULE => true,
1832             _ => false,
1833         }
1834     }
1835     fn cast(syntax: SyntaxNode) -> Option<Self> {
1836         if Self::can_cast(syntax.kind()) {
1837             Some(Self { syntax })
1838         } else {
1839             None
1840         }
1841     }
1842     fn syntax(&self) -> &SyntaxNode {
1843         &self.syntax
1844     }
1845 }
1846 impl ast::VisibilityOwner for Module {}
1847 impl ast::NameOwner for Module {}
1848 impl ast::AttrsOwner for Module {}
1849 impl ast::DocCommentsOwner for Module {}
1850 impl Module {
1851     pub fn item_list(&self) -> Option<ItemList> {
1852         AstChildren::new(&self.syntax).next()
1853     }
1854 }
1855 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1856 pub enum ModuleItem {
1857     StructDef(StructDef),
1858     EnumDef(EnumDef),
1859     FnDef(FnDef),
1860     TraitDef(TraitDef),
1861     TypeAliasDef(TypeAliasDef),
1862     ImplBlock(ImplBlock),
1863     UseItem(UseItem),
1864     ExternCrateItem(ExternCrateItem),
1865     ConstDef(ConstDef),
1866     StaticDef(StaticDef),
1867     Module(Module),
1868 }
1869 impl From<StructDef> for ModuleItem {
1870     fn from(node: StructDef) -> ModuleItem {
1871         ModuleItem::StructDef(node)
1872     }
1873 }
1874 impl From<EnumDef> for ModuleItem {
1875     fn from(node: EnumDef) -> ModuleItem {
1876         ModuleItem::EnumDef(node)
1877     }
1878 }
1879 impl From<FnDef> for ModuleItem {
1880     fn from(node: FnDef) -> ModuleItem {
1881         ModuleItem::FnDef(node)
1882     }
1883 }
1884 impl From<TraitDef> for ModuleItem {
1885     fn from(node: TraitDef) -> ModuleItem {
1886         ModuleItem::TraitDef(node)
1887     }
1888 }
1889 impl From<TypeAliasDef> for ModuleItem {
1890     fn from(node: TypeAliasDef) -> ModuleItem {
1891         ModuleItem::TypeAliasDef(node)
1892     }
1893 }
1894 impl From<ImplBlock> for ModuleItem {
1895     fn from(node: ImplBlock) -> ModuleItem {
1896         ModuleItem::ImplBlock(node)
1897     }
1898 }
1899 impl From<UseItem> for ModuleItem {
1900     fn from(node: UseItem) -> ModuleItem {
1901         ModuleItem::UseItem(node)
1902     }
1903 }
1904 impl From<ExternCrateItem> for ModuleItem {
1905     fn from(node: ExternCrateItem) -> ModuleItem {
1906         ModuleItem::ExternCrateItem(node)
1907     }
1908 }
1909 impl From<ConstDef> for ModuleItem {
1910     fn from(node: ConstDef) -> ModuleItem {
1911         ModuleItem::ConstDef(node)
1912     }
1913 }
1914 impl From<StaticDef> for ModuleItem {
1915     fn from(node: StaticDef) -> ModuleItem {
1916         ModuleItem::StaticDef(node)
1917     }
1918 }
1919 impl From<Module> for ModuleItem {
1920     fn from(node: Module) -> ModuleItem {
1921         ModuleItem::Module(node)
1922     }
1923 }
1924 impl AstNode for ModuleItem {
1925     fn can_cast(kind: SyntaxKind) -> bool {
1926         match kind {
1927             STRUCT_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_BLOCK | USE_ITEM
1928             | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true,
1929             _ => false,
1930         }
1931     }
1932     fn cast(syntax: SyntaxNode) -> Option<Self> {
1933         let res = match syntax.kind() {
1934             STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }),
1935             ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }),
1936             FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
1937             TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
1938             TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
1939             IMPL_BLOCK => ModuleItem::ImplBlock(ImplBlock { syntax }),
1940             USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
1941             EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
1942             CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
1943             STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }),
1944             MODULE => ModuleItem::Module(Module { syntax }),
1945             _ => return None,
1946         };
1947         Some(res)
1948     }
1949     fn syntax(&self) -> &SyntaxNode {
1950         match self {
1951             ModuleItem::StructDef(it) => &it.syntax,
1952             ModuleItem::EnumDef(it) => &it.syntax,
1953             ModuleItem::FnDef(it) => &it.syntax,
1954             ModuleItem::TraitDef(it) => &it.syntax,
1955             ModuleItem::TypeAliasDef(it) => &it.syntax,
1956             ModuleItem::ImplBlock(it) => &it.syntax,
1957             ModuleItem::UseItem(it) => &it.syntax,
1958             ModuleItem::ExternCrateItem(it) => &it.syntax,
1959             ModuleItem::ConstDef(it) => &it.syntax,
1960             ModuleItem::StaticDef(it) => &it.syntax,
1961             ModuleItem::Module(it) => &it.syntax,
1962         }
1963     }
1964 }
1965 impl ModuleItem {}
1966 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1967 pub struct Name {
1968     pub(crate) syntax: SyntaxNode,
1969 }
1970 impl AstNode for Name {
1971     fn can_cast(kind: SyntaxKind) -> bool {
1972         match kind {
1973             NAME => true,
1974             _ => false,
1975         }
1976     }
1977     fn cast(syntax: SyntaxNode) -> Option<Self> {
1978         if Self::can_cast(syntax.kind()) {
1979             Some(Self { syntax })
1980         } else {
1981             None
1982         }
1983     }
1984     fn syntax(&self) -> &SyntaxNode {
1985         &self.syntax
1986     }
1987 }
1988 impl Name {}
1989 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1990 pub struct NameRef {
1991     pub(crate) syntax: SyntaxNode,
1992 }
1993 impl AstNode for NameRef {
1994     fn can_cast(kind: SyntaxKind) -> bool {
1995         match kind {
1996             NAME_REF => true,
1997             _ => false,
1998         }
1999     }
2000     fn cast(syntax: SyntaxNode) -> Option<Self> {
2001         if Self::can_cast(syntax.kind()) {
2002             Some(Self { syntax })
2003         } else {
2004             None
2005         }
2006     }
2007     fn syntax(&self) -> &SyntaxNode {
2008         &self.syntax
2009     }
2010 }
2011 impl NameRef {}
2012 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2013 pub struct NeverType {
2014     pub(crate) syntax: SyntaxNode,
2015 }
2016 impl AstNode for NeverType {
2017     fn can_cast(kind: SyntaxKind) -> bool {
2018         match kind {
2019             NEVER_TYPE => true,
2020             _ => false,
2021         }
2022     }
2023     fn cast(syntax: SyntaxNode) -> Option<Self> {
2024         if Self::can_cast(syntax.kind()) {
2025             Some(Self { syntax })
2026         } else {
2027             None
2028         }
2029     }
2030     fn syntax(&self) -> &SyntaxNode {
2031         &self.syntax
2032     }
2033 }
2034 impl NeverType {}
2035 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2036 pub enum NominalDef {
2037     StructDef(StructDef),
2038     EnumDef(EnumDef),
2039 }
2040 impl From<StructDef> for NominalDef {
2041     fn from(node: StructDef) -> NominalDef {
2042         NominalDef::StructDef(node)
2043     }
2044 }
2045 impl From<EnumDef> for NominalDef {
2046     fn from(node: EnumDef) -> NominalDef {
2047         NominalDef::EnumDef(node)
2048     }
2049 }
2050 impl AstNode for NominalDef {
2051     fn can_cast(kind: SyntaxKind) -> bool {
2052         match kind {
2053             STRUCT_DEF | ENUM_DEF => true,
2054             _ => false,
2055         }
2056     }
2057     fn cast(syntax: SyntaxNode) -> Option<Self> {
2058         let res = match syntax.kind() {
2059             STRUCT_DEF => NominalDef::StructDef(StructDef { syntax }),
2060             ENUM_DEF => NominalDef::EnumDef(EnumDef { syntax }),
2061             _ => return None,
2062         };
2063         Some(res)
2064     }
2065     fn syntax(&self) -> &SyntaxNode {
2066         match self {
2067             NominalDef::StructDef(it) => &it.syntax,
2068             NominalDef::EnumDef(it) => &it.syntax,
2069         }
2070     }
2071 }
2072 impl ast::NameOwner for NominalDef {}
2073 impl ast::TypeParamsOwner for NominalDef {}
2074 impl ast::AttrsOwner for NominalDef {}
2075 impl NominalDef {}
2076 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2077 pub struct Param {
2078     pub(crate) syntax: SyntaxNode,
2079 }
2080 impl AstNode for Param {
2081     fn can_cast(kind: SyntaxKind) -> bool {
2082         match kind {
2083             PARAM => true,
2084             _ => false,
2085         }
2086     }
2087     fn cast(syntax: SyntaxNode) -> Option<Self> {
2088         if Self::can_cast(syntax.kind()) {
2089             Some(Self { syntax })
2090         } else {
2091             None
2092         }
2093     }
2094     fn syntax(&self) -> &SyntaxNode {
2095         &self.syntax
2096     }
2097 }
2098 impl ast::TypeAscriptionOwner for Param {}
2099 impl ast::AttrsOwner for Param {}
2100 impl Param {
2101     pub fn pat(&self) -> Option<Pat> {
2102         AstChildren::new(&self.syntax).next()
2103     }
2104 }
2105 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2106 pub struct ParamList {
2107     pub(crate) syntax: SyntaxNode,
2108 }
2109 impl AstNode for ParamList {
2110     fn can_cast(kind: SyntaxKind) -> bool {
2111         match kind {
2112             PARAM_LIST => true,
2113             _ => false,
2114         }
2115     }
2116     fn cast(syntax: SyntaxNode) -> Option<Self> {
2117         if Self::can_cast(syntax.kind()) {
2118             Some(Self { syntax })
2119         } else {
2120             None
2121         }
2122     }
2123     fn syntax(&self) -> &SyntaxNode {
2124         &self.syntax
2125     }
2126 }
2127 impl ParamList {
2128     pub fn params(&self) -> AstChildren<Param> {
2129         AstChildren::new(&self.syntax)
2130     }
2131     pub fn self_param(&self) -> Option<SelfParam> {
2132         AstChildren::new(&self.syntax).next()
2133     }
2134 }
2135 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2136 pub struct ParenExpr {
2137     pub(crate) syntax: SyntaxNode,
2138 }
2139 impl AstNode for ParenExpr {
2140     fn can_cast(kind: SyntaxKind) -> bool {
2141         match kind {
2142             PAREN_EXPR => true,
2143             _ => false,
2144         }
2145     }
2146     fn cast(syntax: SyntaxNode) -> Option<Self> {
2147         if Self::can_cast(syntax.kind()) {
2148             Some(Self { syntax })
2149         } else {
2150             None
2151         }
2152     }
2153     fn syntax(&self) -> &SyntaxNode {
2154         &self.syntax
2155     }
2156 }
2157 impl ParenExpr {
2158     pub fn expr(&self) -> Option<Expr> {
2159         AstChildren::new(&self.syntax).next()
2160     }
2161 }
2162 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2163 pub struct ParenType {
2164     pub(crate) syntax: SyntaxNode,
2165 }
2166 impl AstNode for ParenType {
2167     fn can_cast(kind: SyntaxKind) -> bool {
2168         match kind {
2169             PAREN_TYPE => true,
2170             _ => false,
2171         }
2172     }
2173     fn cast(syntax: SyntaxNode) -> Option<Self> {
2174         if Self::can_cast(syntax.kind()) {
2175             Some(Self { syntax })
2176         } else {
2177             None
2178         }
2179     }
2180     fn syntax(&self) -> &SyntaxNode {
2181         &self.syntax
2182     }
2183 }
2184 impl ParenType {
2185     pub fn type_ref(&self) -> Option<TypeRef> {
2186         AstChildren::new(&self.syntax).next()
2187     }
2188 }
2189 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2190 pub enum Pat {
2191     RefPat(RefPat),
2192     BoxPat(BoxPat),
2193     BindPat(BindPat),
2194     PlaceholderPat(PlaceholderPat),
2195     DotDotPat(DotDotPat),
2196     PathPat(PathPat),
2197     RecordPat(RecordPat),
2198     TupleStructPat(TupleStructPat),
2199     TuplePat(TuplePat),
2200     SlicePat(SlicePat),
2201     RangePat(RangePat),
2202     LiteralPat(LiteralPat),
2203 }
2204 impl From<RefPat> for Pat {
2205     fn from(node: RefPat) -> Pat {
2206         Pat::RefPat(node)
2207     }
2208 }
2209 impl From<BoxPat> for Pat {
2210     fn from(node: BoxPat) -> Pat {
2211         Pat::BoxPat(node)
2212     }
2213 }
2214 impl From<BindPat> for Pat {
2215     fn from(node: BindPat) -> Pat {
2216         Pat::BindPat(node)
2217     }
2218 }
2219 impl From<PlaceholderPat> for Pat {
2220     fn from(node: PlaceholderPat) -> Pat {
2221         Pat::PlaceholderPat(node)
2222     }
2223 }
2224 impl From<DotDotPat> for Pat {
2225     fn from(node: DotDotPat) -> Pat {
2226         Pat::DotDotPat(node)
2227     }
2228 }
2229 impl From<PathPat> for Pat {
2230     fn from(node: PathPat) -> Pat {
2231         Pat::PathPat(node)
2232     }
2233 }
2234 impl From<RecordPat> for Pat {
2235     fn from(node: RecordPat) -> Pat {
2236         Pat::RecordPat(node)
2237     }
2238 }
2239 impl From<TupleStructPat> for Pat {
2240     fn from(node: TupleStructPat) -> Pat {
2241         Pat::TupleStructPat(node)
2242     }
2243 }
2244 impl From<TuplePat> for Pat {
2245     fn from(node: TuplePat) -> Pat {
2246         Pat::TuplePat(node)
2247     }
2248 }
2249 impl From<SlicePat> for Pat {
2250     fn from(node: SlicePat) -> Pat {
2251         Pat::SlicePat(node)
2252     }
2253 }
2254 impl From<RangePat> for Pat {
2255     fn from(node: RangePat) -> Pat {
2256         Pat::RangePat(node)
2257     }
2258 }
2259 impl From<LiteralPat> for Pat {
2260     fn from(node: LiteralPat) -> Pat {
2261         Pat::LiteralPat(node)
2262     }
2263 }
2264 impl AstNode for Pat {
2265     fn can_cast(kind: SyntaxKind) -> bool {
2266         match kind {
2267             REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | PATH_PAT
2268             | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => {
2269                 true
2270             }
2271             _ => false,
2272         }
2273     }
2274     fn cast(syntax: SyntaxNode) -> Option<Self> {
2275         let res = match syntax.kind() {
2276             REF_PAT => Pat::RefPat(RefPat { syntax }),
2277             BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
2278             BIND_PAT => Pat::BindPat(BindPat { syntax }),
2279             PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
2280             DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
2281             PATH_PAT => Pat::PathPat(PathPat { syntax }),
2282             RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
2283             TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
2284             TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
2285             SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
2286             RANGE_PAT => Pat::RangePat(RangePat { syntax }),
2287             LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
2288             _ => return None,
2289         };
2290         Some(res)
2291     }
2292     fn syntax(&self) -> &SyntaxNode {
2293         match self {
2294             Pat::RefPat(it) => &it.syntax,
2295             Pat::BoxPat(it) => &it.syntax,
2296             Pat::BindPat(it) => &it.syntax,
2297             Pat::PlaceholderPat(it) => &it.syntax,
2298             Pat::DotDotPat(it) => &it.syntax,
2299             Pat::PathPat(it) => &it.syntax,
2300             Pat::RecordPat(it) => &it.syntax,
2301             Pat::TupleStructPat(it) => &it.syntax,
2302             Pat::TuplePat(it) => &it.syntax,
2303             Pat::SlicePat(it) => &it.syntax,
2304             Pat::RangePat(it) => &it.syntax,
2305             Pat::LiteralPat(it) => &it.syntax,
2306         }
2307     }
2308 }
2309 impl Pat {}
2310 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2311 pub struct Path {
2312     pub(crate) syntax: SyntaxNode,
2313 }
2314 impl AstNode for Path {
2315     fn can_cast(kind: SyntaxKind) -> bool {
2316         match kind {
2317             PATH => true,
2318             _ => false,
2319         }
2320     }
2321     fn cast(syntax: SyntaxNode) -> Option<Self> {
2322         if Self::can_cast(syntax.kind()) {
2323             Some(Self { syntax })
2324         } else {
2325             None
2326         }
2327     }
2328     fn syntax(&self) -> &SyntaxNode {
2329         &self.syntax
2330     }
2331 }
2332 impl Path {
2333     pub fn segment(&self) -> Option<PathSegment> {
2334         AstChildren::new(&self.syntax).next()
2335     }
2336     pub fn qualifier(&self) -> Option<Path> {
2337         AstChildren::new(&self.syntax).next()
2338     }
2339 }
2340 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2341 pub struct PathExpr {
2342     pub(crate) syntax: SyntaxNode,
2343 }
2344 impl AstNode for PathExpr {
2345     fn can_cast(kind: SyntaxKind) -> bool {
2346         match kind {
2347             PATH_EXPR => true,
2348             _ => false,
2349         }
2350     }
2351     fn cast(syntax: SyntaxNode) -> Option<Self> {
2352         if Self::can_cast(syntax.kind()) {
2353             Some(Self { syntax })
2354         } else {
2355             None
2356         }
2357     }
2358     fn syntax(&self) -> &SyntaxNode {
2359         &self.syntax
2360     }
2361 }
2362 impl PathExpr {
2363     pub fn path(&self) -> Option<Path> {
2364         AstChildren::new(&self.syntax).next()
2365     }
2366 }
2367 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2368 pub struct PathPat {
2369     pub(crate) syntax: SyntaxNode,
2370 }
2371 impl AstNode for PathPat {
2372     fn can_cast(kind: SyntaxKind) -> bool {
2373         match kind {
2374             PATH_PAT => true,
2375             _ => false,
2376         }
2377     }
2378     fn cast(syntax: SyntaxNode) -> Option<Self> {
2379         if Self::can_cast(syntax.kind()) {
2380             Some(Self { syntax })
2381         } else {
2382             None
2383         }
2384     }
2385     fn syntax(&self) -> &SyntaxNode {
2386         &self.syntax
2387     }
2388 }
2389 impl PathPat {
2390     pub fn path(&self) -> Option<Path> {
2391         AstChildren::new(&self.syntax).next()
2392     }
2393 }
2394 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2395 pub struct PathSegment {
2396     pub(crate) syntax: SyntaxNode,
2397 }
2398 impl AstNode for PathSegment {
2399     fn can_cast(kind: SyntaxKind) -> bool {
2400         match kind {
2401             PATH_SEGMENT => true,
2402             _ => false,
2403         }
2404     }
2405     fn cast(syntax: SyntaxNode) -> Option<Self> {
2406         if Self::can_cast(syntax.kind()) {
2407             Some(Self { syntax })
2408         } else {
2409             None
2410         }
2411     }
2412     fn syntax(&self) -> &SyntaxNode {
2413         &self.syntax
2414     }
2415 }
2416 impl PathSegment {
2417     pub fn name_ref(&self) -> Option<NameRef> {
2418         AstChildren::new(&self.syntax).next()
2419     }
2420     pub fn type_arg_list(&self) -> Option<TypeArgList> {
2421         AstChildren::new(&self.syntax).next()
2422     }
2423     pub fn param_list(&self) -> Option<ParamList> {
2424         AstChildren::new(&self.syntax).next()
2425     }
2426     pub fn ret_type(&self) -> Option<RetType> {
2427         AstChildren::new(&self.syntax).next()
2428     }
2429     pub fn path_type(&self) -> Option<PathType> {
2430         AstChildren::new(&self.syntax).next()
2431     }
2432 }
2433 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2434 pub struct PathType {
2435     pub(crate) syntax: SyntaxNode,
2436 }
2437 impl AstNode for PathType {
2438     fn can_cast(kind: SyntaxKind) -> bool {
2439         match kind {
2440             PATH_TYPE => true,
2441             _ => false,
2442         }
2443     }
2444     fn cast(syntax: SyntaxNode) -> Option<Self> {
2445         if Self::can_cast(syntax.kind()) {
2446             Some(Self { syntax })
2447         } else {
2448             None
2449         }
2450     }
2451     fn syntax(&self) -> &SyntaxNode {
2452         &self.syntax
2453     }
2454 }
2455 impl PathType {
2456     pub fn path(&self) -> Option<Path> {
2457         AstChildren::new(&self.syntax).next()
2458     }
2459 }
2460 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2461 pub struct PlaceholderPat {
2462     pub(crate) syntax: SyntaxNode,
2463 }
2464 impl AstNode for PlaceholderPat {
2465     fn can_cast(kind: SyntaxKind) -> bool {
2466         match kind {
2467             PLACEHOLDER_PAT => true,
2468             _ => false,
2469         }
2470     }
2471     fn cast(syntax: SyntaxNode) -> Option<Self> {
2472         if Self::can_cast(syntax.kind()) {
2473             Some(Self { syntax })
2474         } else {
2475             None
2476         }
2477     }
2478     fn syntax(&self) -> &SyntaxNode {
2479         &self.syntax
2480     }
2481 }
2482 impl PlaceholderPat {}
2483 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2484 pub struct PlaceholderType {
2485     pub(crate) syntax: SyntaxNode,
2486 }
2487 impl AstNode for PlaceholderType {
2488     fn can_cast(kind: SyntaxKind) -> bool {
2489         match kind {
2490             PLACEHOLDER_TYPE => true,
2491             _ => false,
2492         }
2493     }
2494     fn cast(syntax: SyntaxNode) -> Option<Self> {
2495         if Self::can_cast(syntax.kind()) {
2496             Some(Self { syntax })
2497         } else {
2498             None
2499         }
2500     }
2501     fn syntax(&self) -> &SyntaxNode {
2502         &self.syntax
2503     }
2504 }
2505 impl PlaceholderType {}
2506 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2507 pub struct PointerType {
2508     pub(crate) syntax: SyntaxNode,
2509 }
2510 impl AstNode for PointerType {
2511     fn can_cast(kind: SyntaxKind) -> bool {
2512         match kind {
2513             POINTER_TYPE => true,
2514             _ => false,
2515         }
2516     }
2517     fn cast(syntax: SyntaxNode) -> Option<Self> {
2518         if Self::can_cast(syntax.kind()) {
2519             Some(Self { syntax })
2520         } else {
2521             None
2522         }
2523     }
2524     fn syntax(&self) -> &SyntaxNode {
2525         &self.syntax
2526     }
2527 }
2528 impl PointerType {
2529     pub fn type_ref(&self) -> Option<TypeRef> {
2530         AstChildren::new(&self.syntax).next()
2531     }
2532 }
2533 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2534 pub struct PrefixExpr {
2535     pub(crate) syntax: SyntaxNode,
2536 }
2537 impl AstNode for PrefixExpr {
2538     fn can_cast(kind: SyntaxKind) -> bool {
2539         match kind {
2540             PREFIX_EXPR => true,
2541             _ => false,
2542         }
2543     }
2544     fn cast(syntax: SyntaxNode) -> Option<Self> {
2545         if Self::can_cast(syntax.kind()) {
2546             Some(Self { syntax })
2547         } else {
2548             None
2549         }
2550     }
2551     fn syntax(&self) -> &SyntaxNode {
2552         &self.syntax
2553     }
2554 }
2555 impl PrefixExpr {
2556     pub fn expr(&self) -> Option<Expr> {
2557         AstChildren::new(&self.syntax).next()
2558     }
2559 }
2560 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2561 pub struct RangeExpr {
2562     pub(crate) syntax: SyntaxNode,
2563 }
2564 impl AstNode for RangeExpr {
2565     fn can_cast(kind: SyntaxKind) -> bool {
2566         match kind {
2567             RANGE_EXPR => true,
2568             _ => false,
2569         }
2570     }
2571     fn cast(syntax: SyntaxNode) -> Option<Self> {
2572         if Self::can_cast(syntax.kind()) {
2573             Some(Self { syntax })
2574         } else {
2575             None
2576         }
2577     }
2578     fn syntax(&self) -> &SyntaxNode {
2579         &self.syntax
2580     }
2581 }
2582 impl RangeExpr {}
2583 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2584 pub struct RangePat {
2585     pub(crate) syntax: SyntaxNode,
2586 }
2587 impl AstNode for RangePat {
2588     fn can_cast(kind: SyntaxKind) -> bool {
2589         match kind {
2590             RANGE_PAT => true,
2591             _ => false,
2592         }
2593     }
2594     fn cast(syntax: SyntaxNode) -> Option<Self> {
2595         if Self::can_cast(syntax.kind()) {
2596             Some(Self { syntax })
2597         } else {
2598             None
2599         }
2600     }
2601     fn syntax(&self) -> &SyntaxNode {
2602         &self.syntax
2603     }
2604 }
2605 impl RangePat {}
2606 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2607 pub struct RecordField {
2608     pub(crate) syntax: SyntaxNode,
2609 }
2610 impl AstNode for RecordField {
2611     fn can_cast(kind: SyntaxKind) -> bool {
2612         match kind {
2613             RECORD_FIELD => true,
2614             _ => false,
2615         }
2616     }
2617     fn cast(syntax: SyntaxNode) -> Option<Self> {
2618         if Self::can_cast(syntax.kind()) {
2619             Some(Self { syntax })
2620         } else {
2621             None
2622         }
2623     }
2624     fn syntax(&self) -> &SyntaxNode {
2625         &self.syntax
2626     }
2627 }
2628 impl RecordField {
2629     pub fn name_ref(&self) -> Option<NameRef> {
2630         AstChildren::new(&self.syntax).next()
2631     }
2632     pub fn expr(&self) -> Option<Expr> {
2633         AstChildren::new(&self.syntax).next()
2634     }
2635 }
2636 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2637 pub struct RecordFieldDef {
2638     pub(crate) syntax: SyntaxNode,
2639 }
2640 impl AstNode for RecordFieldDef {
2641     fn can_cast(kind: SyntaxKind) -> bool {
2642         match kind {
2643             RECORD_FIELD_DEF => true,
2644             _ => false,
2645         }
2646     }
2647     fn cast(syntax: SyntaxNode) -> Option<Self> {
2648         if Self::can_cast(syntax.kind()) {
2649             Some(Self { syntax })
2650         } else {
2651             None
2652         }
2653     }
2654     fn syntax(&self) -> &SyntaxNode {
2655         &self.syntax
2656     }
2657 }
2658 impl ast::VisibilityOwner for RecordFieldDef {}
2659 impl ast::NameOwner for RecordFieldDef {}
2660 impl ast::AttrsOwner for RecordFieldDef {}
2661 impl ast::DocCommentsOwner for RecordFieldDef {}
2662 impl ast::TypeAscriptionOwner for RecordFieldDef {}
2663 impl RecordFieldDef {}
2664 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2665 pub struct RecordFieldDefList {
2666     pub(crate) syntax: SyntaxNode,
2667 }
2668 impl AstNode for RecordFieldDefList {
2669     fn can_cast(kind: SyntaxKind) -> bool {
2670         match kind {
2671             RECORD_FIELD_DEF_LIST => true,
2672             _ => false,
2673         }
2674     }
2675     fn cast(syntax: SyntaxNode) -> Option<Self> {
2676         if Self::can_cast(syntax.kind()) {
2677             Some(Self { syntax })
2678         } else {
2679             None
2680         }
2681     }
2682     fn syntax(&self) -> &SyntaxNode {
2683         &self.syntax
2684     }
2685 }
2686 impl RecordFieldDefList {
2687     pub fn fields(&self) -> AstChildren<RecordFieldDef> {
2688         AstChildren::new(&self.syntax)
2689     }
2690 }
2691 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2692 pub struct RecordFieldList {
2693     pub(crate) syntax: SyntaxNode,
2694 }
2695 impl AstNode for RecordFieldList {
2696     fn can_cast(kind: SyntaxKind) -> bool {
2697         match kind {
2698             RECORD_FIELD_LIST => true,
2699             _ => false,
2700         }
2701     }
2702     fn cast(syntax: SyntaxNode) -> Option<Self> {
2703         if Self::can_cast(syntax.kind()) {
2704             Some(Self { syntax })
2705         } else {
2706             None
2707         }
2708     }
2709     fn syntax(&self) -> &SyntaxNode {
2710         &self.syntax
2711     }
2712 }
2713 impl RecordFieldList {
2714     pub fn fields(&self) -> AstChildren<RecordField> {
2715         AstChildren::new(&self.syntax)
2716     }
2717     pub fn spread(&self) -> Option<Expr> {
2718         AstChildren::new(&self.syntax).next()
2719     }
2720 }
2721 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2722 pub struct RecordFieldPat {
2723     pub(crate) syntax: SyntaxNode,
2724 }
2725 impl AstNode for RecordFieldPat {
2726     fn can_cast(kind: SyntaxKind) -> bool {
2727         match kind {
2728             RECORD_FIELD_PAT => true,
2729             _ => false,
2730         }
2731     }
2732     fn cast(syntax: SyntaxNode) -> Option<Self> {
2733         if Self::can_cast(syntax.kind()) {
2734             Some(Self { syntax })
2735         } else {
2736             None
2737         }
2738     }
2739     fn syntax(&self) -> &SyntaxNode {
2740         &self.syntax
2741     }
2742 }
2743 impl ast::NameOwner for RecordFieldPat {}
2744 impl RecordFieldPat {
2745     pub fn pat(&self) -> Option<Pat> {
2746         AstChildren::new(&self.syntax).next()
2747     }
2748 }
2749 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2750 pub struct RecordFieldPatList {
2751     pub(crate) syntax: SyntaxNode,
2752 }
2753 impl AstNode for RecordFieldPatList {
2754     fn can_cast(kind: SyntaxKind) -> bool {
2755         match kind {
2756             RECORD_FIELD_PAT_LIST => true,
2757             _ => false,
2758         }
2759     }
2760     fn cast(syntax: SyntaxNode) -> Option<Self> {
2761         if Self::can_cast(syntax.kind()) {
2762             Some(Self { syntax })
2763         } else {
2764             None
2765         }
2766     }
2767     fn syntax(&self) -> &SyntaxNode {
2768         &self.syntax
2769     }
2770 }
2771 impl RecordFieldPatList {
2772     pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
2773         AstChildren::new(&self.syntax)
2774     }
2775     pub fn bind_pats(&self) -> AstChildren<BindPat> {
2776         AstChildren::new(&self.syntax)
2777     }
2778 }
2779 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2780 pub struct RecordLit {
2781     pub(crate) syntax: SyntaxNode,
2782 }
2783 impl AstNode for RecordLit {
2784     fn can_cast(kind: SyntaxKind) -> bool {
2785         match kind {
2786             RECORD_LIT => true,
2787             _ => false,
2788         }
2789     }
2790     fn cast(syntax: SyntaxNode) -> Option<Self> {
2791         if Self::can_cast(syntax.kind()) {
2792             Some(Self { syntax })
2793         } else {
2794             None
2795         }
2796     }
2797     fn syntax(&self) -> &SyntaxNode {
2798         &self.syntax
2799     }
2800 }
2801 impl RecordLit {
2802     pub fn path(&self) -> Option<Path> {
2803         AstChildren::new(&self.syntax).next()
2804     }
2805     pub fn record_field_list(&self) -> Option<RecordFieldList> {
2806         AstChildren::new(&self.syntax).next()
2807     }
2808 }
2809 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2810 pub struct RecordPat {
2811     pub(crate) syntax: SyntaxNode,
2812 }
2813 impl AstNode for RecordPat {
2814     fn can_cast(kind: SyntaxKind) -> bool {
2815         match kind {
2816             RECORD_PAT => true,
2817             _ => false,
2818         }
2819     }
2820     fn cast(syntax: SyntaxNode) -> Option<Self> {
2821         if Self::can_cast(syntax.kind()) {
2822             Some(Self { syntax })
2823         } else {
2824             None
2825         }
2826     }
2827     fn syntax(&self) -> &SyntaxNode {
2828         &self.syntax
2829     }
2830 }
2831 impl RecordPat {
2832     pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
2833         AstChildren::new(&self.syntax).next()
2834     }
2835     pub fn path(&self) -> Option<Path> {
2836         AstChildren::new(&self.syntax).next()
2837     }
2838 }
2839 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2840 pub struct RefExpr {
2841     pub(crate) syntax: SyntaxNode,
2842 }
2843 impl AstNode for RefExpr {
2844     fn can_cast(kind: SyntaxKind) -> bool {
2845         match kind {
2846             REF_EXPR => true,
2847             _ => false,
2848         }
2849     }
2850     fn cast(syntax: SyntaxNode) -> Option<Self> {
2851         if Self::can_cast(syntax.kind()) {
2852             Some(Self { syntax })
2853         } else {
2854             None
2855         }
2856     }
2857     fn syntax(&self) -> &SyntaxNode {
2858         &self.syntax
2859     }
2860 }
2861 impl RefExpr {
2862     pub fn expr(&self) -> Option<Expr> {
2863         AstChildren::new(&self.syntax).next()
2864     }
2865 }
2866 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2867 pub struct RefPat {
2868     pub(crate) syntax: SyntaxNode,
2869 }
2870 impl AstNode for RefPat {
2871     fn can_cast(kind: SyntaxKind) -> bool {
2872         match kind {
2873             REF_PAT => true,
2874             _ => false,
2875         }
2876     }
2877     fn cast(syntax: SyntaxNode) -> Option<Self> {
2878         if Self::can_cast(syntax.kind()) {
2879             Some(Self { syntax })
2880         } else {
2881             None
2882         }
2883     }
2884     fn syntax(&self) -> &SyntaxNode {
2885         &self.syntax
2886     }
2887 }
2888 impl RefPat {
2889     pub fn pat(&self) -> Option<Pat> {
2890         AstChildren::new(&self.syntax).next()
2891     }
2892 }
2893 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2894 pub struct ReferenceType {
2895     pub(crate) syntax: SyntaxNode,
2896 }
2897 impl AstNode for ReferenceType {
2898     fn can_cast(kind: SyntaxKind) -> bool {
2899         match kind {
2900             REFERENCE_TYPE => true,
2901             _ => false,
2902         }
2903     }
2904     fn cast(syntax: SyntaxNode) -> Option<Self> {
2905         if Self::can_cast(syntax.kind()) {
2906             Some(Self { syntax })
2907         } else {
2908             None
2909         }
2910     }
2911     fn syntax(&self) -> &SyntaxNode {
2912         &self.syntax
2913     }
2914 }
2915 impl ReferenceType {
2916     pub fn type_ref(&self) -> Option<TypeRef> {
2917         AstChildren::new(&self.syntax).next()
2918     }
2919 }
2920 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2921 pub struct RetType {
2922     pub(crate) syntax: SyntaxNode,
2923 }
2924 impl AstNode for RetType {
2925     fn can_cast(kind: SyntaxKind) -> bool {
2926         match kind {
2927             RET_TYPE => true,
2928             _ => false,
2929         }
2930     }
2931     fn cast(syntax: SyntaxNode) -> Option<Self> {
2932         if Self::can_cast(syntax.kind()) {
2933             Some(Self { syntax })
2934         } else {
2935             None
2936         }
2937     }
2938     fn syntax(&self) -> &SyntaxNode {
2939         &self.syntax
2940     }
2941 }
2942 impl RetType {
2943     pub fn type_ref(&self) -> Option<TypeRef> {
2944         AstChildren::new(&self.syntax).next()
2945     }
2946 }
2947 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2948 pub struct ReturnExpr {
2949     pub(crate) syntax: SyntaxNode,
2950 }
2951 impl AstNode for ReturnExpr {
2952     fn can_cast(kind: SyntaxKind) -> bool {
2953         match kind {
2954             RETURN_EXPR => true,
2955             _ => false,
2956         }
2957     }
2958     fn cast(syntax: SyntaxNode) -> Option<Self> {
2959         if Self::can_cast(syntax.kind()) {
2960             Some(Self { syntax })
2961         } else {
2962             None
2963         }
2964     }
2965     fn syntax(&self) -> &SyntaxNode {
2966         &self.syntax
2967     }
2968 }
2969 impl ReturnExpr {
2970     pub fn expr(&self) -> Option<Expr> {
2971         AstChildren::new(&self.syntax).next()
2972     }
2973 }
2974 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2975 pub struct SelfParam {
2976     pub(crate) syntax: SyntaxNode,
2977 }
2978 impl AstNode for SelfParam {
2979     fn can_cast(kind: SyntaxKind) -> bool {
2980         match kind {
2981             SELF_PARAM => true,
2982             _ => false,
2983         }
2984     }
2985     fn cast(syntax: SyntaxNode) -> Option<Self> {
2986         if Self::can_cast(syntax.kind()) {
2987             Some(Self { syntax })
2988         } else {
2989             None
2990         }
2991     }
2992     fn syntax(&self) -> &SyntaxNode {
2993         &self.syntax
2994     }
2995 }
2996 impl ast::TypeAscriptionOwner for SelfParam {}
2997 impl ast::AttrsOwner for SelfParam {}
2998 impl SelfParam {}
2999 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3000 pub struct SlicePat {
3001     pub(crate) syntax: SyntaxNode,
3002 }
3003 impl AstNode for SlicePat {
3004     fn can_cast(kind: SyntaxKind) -> bool {
3005         match kind {
3006             SLICE_PAT => true,
3007             _ => false,
3008         }
3009     }
3010     fn cast(syntax: SyntaxNode) -> Option<Self> {
3011         if Self::can_cast(syntax.kind()) {
3012             Some(Self { syntax })
3013         } else {
3014             None
3015         }
3016     }
3017     fn syntax(&self) -> &SyntaxNode {
3018         &self.syntax
3019     }
3020 }
3021 impl SlicePat {}
3022 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3023 pub struct SliceType {
3024     pub(crate) syntax: SyntaxNode,
3025 }
3026 impl AstNode for SliceType {
3027     fn can_cast(kind: SyntaxKind) -> bool {
3028         match kind {
3029             SLICE_TYPE => true,
3030             _ => false,
3031         }
3032     }
3033     fn cast(syntax: SyntaxNode) -> Option<Self> {
3034         if Self::can_cast(syntax.kind()) {
3035             Some(Self { syntax })
3036         } else {
3037             None
3038         }
3039     }
3040     fn syntax(&self) -> &SyntaxNode {
3041         &self.syntax
3042     }
3043 }
3044 impl SliceType {
3045     pub fn type_ref(&self) -> Option<TypeRef> {
3046         AstChildren::new(&self.syntax).next()
3047     }
3048 }
3049 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3050 pub struct SourceFile {
3051     pub(crate) syntax: SyntaxNode,
3052 }
3053 impl AstNode for SourceFile {
3054     fn can_cast(kind: SyntaxKind) -> bool {
3055         match kind {
3056             SOURCE_FILE => true,
3057             _ => false,
3058         }
3059     }
3060     fn cast(syntax: SyntaxNode) -> Option<Self> {
3061         if Self::can_cast(syntax.kind()) {
3062             Some(Self { syntax })
3063         } else {
3064             None
3065         }
3066     }
3067     fn syntax(&self) -> &SyntaxNode {
3068         &self.syntax
3069     }
3070 }
3071 impl ast::ModuleItemOwner for SourceFile {}
3072 impl ast::FnDefOwner for SourceFile {}
3073 impl SourceFile {
3074     pub fn modules(&self) -> AstChildren<Module> {
3075         AstChildren::new(&self.syntax)
3076     }
3077 }
3078 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3079 pub struct StaticDef {
3080     pub(crate) syntax: SyntaxNode,
3081 }
3082 impl AstNode for StaticDef {
3083     fn can_cast(kind: SyntaxKind) -> bool {
3084         match kind {
3085             STATIC_DEF => true,
3086             _ => false,
3087         }
3088     }
3089     fn cast(syntax: SyntaxNode) -> Option<Self> {
3090         if Self::can_cast(syntax.kind()) {
3091             Some(Self { syntax })
3092         } else {
3093             None
3094         }
3095     }
3096     fn syntax(&self) -> &SyntaxNode {
3097         &self.syntax
3098     }
3099 }
3100 impl ast::VisibilityOwner for StaticDef {}
3101 impl ast::NameOwner for StaticDef {}
3102 impl ast::TypeParamsOwner for StaticDef {}
3103 impl ast::AttrsOwner for StaticDef {}
3104 impl ast::DocCommentsOwner for StaticDef {}
3105 impl ast::TypeAscriptionOwner for StaticDef {}
3106 impl StaticDef {
3107     pub fn body(&self) -> Option<Expr> {
3108         AstChildren::new(&self.syntax).next()
3109     }
3110 }
3111 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3112 pub enum Stmt {
3113     ExprStmt(ExprStmt),
3114     LetStmt(LetStmt),
3115 }
3116 impl From<ExprStmt> for Stmt {
3117     fn from(node: ExprStmt) -> Stmt {
3118         Stmt::ExprStmt(node)
3119     }
3120 }
3121 impl From<LetStmt> for Stmt {
3122     fn from(node: LetStmt) -> Stmt {
3123         Stmt::LetStmt(node)
3124     }
3125 }
3126 impl AstNode for Stmt {
3127     fn can_cast(kind: SyntaxKind) -> bool {
3128         match kind {
3129             EXPR_STMT | LET_STMT => true,
3130             _ => false,
3131         }
3132     }
3133     fn cast(syntax: SyntaxNode) -> Option<Self> {
3134         let res = match syntax.kind() {
3135             EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
3136             LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
3137             _ => return None,
3138         };
3139         Some(res)
3140     }
3141     fn syntax(&self) -> &SyntaxNode {
3142         match self {
3143             Stmt::ExprStmt(it) => &it.syntax,
3144             Stmt::LetStmt(it) => &it.syntax,
3145         }
3146     }
3147 }
3148 impl Stmt {}
3149 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3150 pub struct StructDef {
3151     pub(crate) syntax: SyntaxNode,
3152 }
3153 impl AstNode for StructDef {
3154     fn can_cast(kind: SyntaxKind) -> bool {
3155         match kind {
3156             STRUCT_DEF => true,
3157             _ => false,
3158         }
3159     }
3160     fn cast(syntax: SyntaxNode) -> Option<Self> {
3161         if Self::can_cast(syntax.kind()) {
3162             Some(Self { syntax })
3163         } else {
3164             None
3165         }
3166     }
3167     fn syntax(&self) -> &SyntaxNode {
3168         &self.syntax
3169     }
3170 }
3171 impl ast::VisibilityOwner for StructDef {}
3172 impl ast::NameOwner for StructDef {}
3173 impl ast::TypeParamsOwner for StructDef {}
3174 impl ast::AttrsOwner for StructDef {}
3175 impl ast::DocCommentsOwner for StructDef {}
3176 impl StructDef {}
3177 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3178 pub struct TokenTree {
3179     pub(crate) syntax: SyntaxNode,
3180 }
3181 impl AstNode for TokenTree {
3182     fn can_cast(kind: SyntaxKind) -> bool {
3183         match kind {
3184             TOKEN_TREE => true,
3185             _ => false,
3186         }
3187     }
3188     fn cast(syntax: SyntaxNode) -> Option<Self> {
3189         if Self::can_cast(syntax.kind()) {
3190             Some(Self { syntax })
3191         } else {
3192             None
3193         }
3194     }
3195     fn syntax(&self) -> &SyntaxNode {
3196         &self.syntax
3197     }
3198 }
3199 impl TokenTree {}
3200 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3201 pub struct TraitDef {
3202     pub(crate) syntax: SyntaxNode,
3203 }
3204 impl AstNode for TraitDef {
3205     fn can_cast(kind: SyntaxKind) -> bool {
3206         match kind {
3207             TRAIT_DEF => true,
3208             _ => false,
3209         }
3210     }
3211     fn cast(syntax: SyntaxNode) -> Option<Self> {
3212         if Self::can_cast(syntax.kind()) {
3213             Some(Self { syntax })
3214         } else {
3215             None
3216         }
3217     }
3218     fn syntax(&self) -> &SyntaxNode {
3219         &self.syntax
3220     }
3221 }
3222 impl ast::VisibilityOwner for TraitDef {}
3223 impl ast::NameOwner for TraitDef {}
3224 impl ast::AttrsOwner for TraitDef {}
3225 impl ast::DocCommentsOwner for TraitDef {}
3226 impl ast::TypeParamsOwner for TraitDef {}
3227 impl ast::TypeBoundsOwner for TraitDef {}
3228 impl TraitDef {
3229     pub fn item_list(&self) -> Option<ItemList> {
3230         AstChildren::new(&self.syntax).next()
3231     }
3232 }
3233 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3234 pub struct TryBlockExpr {
3235     pub(crate) syntax: SyntaxNode,
3236 }
3237 impl AstNode for TryBlockExpr {
3238     fn can_cast(kind: SyntaxKind) -> bool {
3239         match kind {
3240             TRY_BLOCK_EXPR => true,
3241             _ => false,
3242         }
3243     }
3244     fn cast(syntax: SyntaxNode) -> Option<Self> {
3245         if Self::can_cast(syntax.kind()) {
3246             Some(Self { syntax })
3247         } else {
3248             None
3249         }
3250     }
3251     fn syntax(&self) -> &SyntaxNode {
3252         &self.syntax
3253     }
3254 }
3255 impl TryBlockExpr {
3256     pub fn body(&self) -> Option<BlockExpr> {
3257         AstChildren::new(&self.syntax).next()
3258     }
3259 }
3260 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3261 pub struct TryExpr {
3262     pub(crate) syntax: SyntaxNode,
3263 }
3264 impl AstNode for TryExpr {
3265     fn can_cast(kind: SyntaxKind) -> bool {
3266         match kind {
3267             TRY_EXPR => true,
3268             _ => false,
3269         }
3270     }
3271     fn cast(syntax: SyntaxNode) -> Option<Self> {
3272         if Self::can_cast(syntax.kind()) {
3273             Some(Self { syntax })
3274         } else {
3275             None
3276         }
3277     }
3278     fn syntax(&self) -> &SyntaxNode {
3279         &self.syntax
3280     }
3281 }
3282 impl TryExpr {
3283     pub fn expr(&self) -> Option<Expr> {
3284         AstChildren::new(&self.syntax).next()
3285     }
3286 }
3287 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3288 pub struct TupleExpr {
3289     pub(crate) syntax: SyntaxNode,
3290 }
3291 impl AstNode for TupleExpr {
3292     fn can_cast(kind: SyntaxKind) -> bool {
3293         match kind {
3294             TUPLE_EXPR => true,
3295             _ => false,
3296         }
3297     }
3298     fn cast(syntax: SyntaxNode) -> Option<Self> {
3299         if Self::can_cast(syntax.kind()) {
3300             Some(Self { syntax })
3301         } else {
3302             None
3303         }
3304     }
3305     fn syntax(&self) -> &SyntaxNode {
3306         &self.syntax
3307     }
3308 }
3309 impl TupleExpr {
3310     pub fn exprs(&self) -> AstChildren<Expr> {
3311         AstChildren::new(&self.syntax)
3312     }
3313 }
3314 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3315 pub struct TupleFieldDef {
3316     pub(crate) syntax: SyntaxNode,
3317 }
3318 impl AstNode for TupleFieldDef {
3319     fn can_cast(kind: SyntaxKind) -> bool {
3320         match kind {
3321             TUPLE_FIELD_DEF => true,
3322             _ => false,
3323         }
3324     }
3325     fn cast(syntax: SyntaxNode) -> Option<Self> {
3326         if Self::can_cast(syntax.kind()) {
3327             Some(Self { syntax })
3328         } else {
3329             None
3330         }
3331     }
3332     fn syntax(&self) -> &SyntaxNode {
3333         &self.syntax
3334     }
3335 }
3336 impl ast::VisibilityOwner for TupleFieldDef {}
3337 impl ast::AttrsOwner for TupleFieldDef {}
3338 impl TupleFieldDef {
3339     pub fn type_ref(&self) -> Option<TypeRef> {
3340         AstChildren::new(&self.syntax).next()
3341     }
3342 }
3343 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3344 pub struct TupleFieldDefList {
3345     pub(crate) syntax: SyntaxNode,
3346 }
3347 impl AstNode for TupleFieldDefList {
3348     fn can_cast(kind: SyntaxKind) -> bool {
3349         match kind {
3350             TUPLE_FIELD_DEF_LIST => true,
3351             _ => false,
3352         }
3353     }
3354     fn cast(syntax: SyntaxNode) -> Option<Self> {
3355         if Self::can_cast(syntax.kind()) {
3356             Some(Self { syntax })
3357         } else {
3358             None
3359         }
3360     }
3361     fn syntax(&self) -> &SyntaxNode {
3362         &self.syntax
3363     }
3364 }
3365 impl TupleFieldDefList {
3366     pub fn fields(&self) -> AstChildren<TupleFieldDef> {
3367         AstChildren::new(&self.syntax)
3368     }
3369 }
3370 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3371 pub struct TuplePat {
3372     pub(crate) syntax: SyntaxNode,
3373 }
3374 impl AstNode for TuplePat {
3375     fn can_cast(kind: SyntaxKind) -> bool {
3376         match kind {
3377             TUPLE_PAT => true,
3378             _ => false,
3379         }
3380     }
3381     fn cast(syntax: SyntaxNode) -> Option<Self> {
3382         if Self::can_cast(syntax.kind()) {
3383             Some(Self { syntax })
3384         } else {
3385             None
3386         }
3387     }
3388     fn syntax(&self) -> &SyntaxNode {
3389         &self.syntax
3390     }
3391 }
3392 impl TuplePat {
3393     pub fn args(&self) -> AstChildren<Pat> {
3394         AstChildren::new(&self.syntax)
3395     }
3396 }
3397 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3398 pub struct TupleStructPat {
3399     pub(crate) syntax: SyntaxNode,
3400 }
3401 impl AstNode for TupleStructPat {
3402     fn can_cast(kind: SyntaxKind) -> bool {
3403         match kind {
3404             TUPLE_STRUCT_PAT => true,
3405             _ => false,
3406         }
3407     }
3408     fn cast(syntax: SyntaxNode) -> Option<Self> {
3409         if Self::can_cast(syntax.kind()) {
3410             Some(Self { syntax })
3411         } else {
3412             None
3413         }
3414     }
3415     fn syntax(&self) -> &SyntaxNode {
3416         &self.syntax
3417     }
3418 }
3419 impl TupleStructPat {
3420     pub fn args(&self) -> AstChildren<Pat> {
3421         AstChildren::new(&self.syntax)
3422     }
3423     pub fn path(&self) -> Option<Path> {
3424         AstChildren::new(&self.syntax).next()
3425     }
3426 }
3427 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3428 pub struct TupleType {
3429     pub(crate) syntax: SyntaxNode,
3430 }
3431 impl AstNode for TupleType {
3432     fn can_cast(kind: SyntaxKind) -> bool {
3433         match kind {
3434             TUPLE_TYPE => true,
3435             _ => false,
3436         }
3437     }
3438     fn cast(syntax: SyntaxNode) -> Option<Self> {
3439         if Self::can_cast(syntax.kind()) {
3440             Some(Self { syntax })
3441         } else {
3442             None
3443         }
3444     }
3445     fn syntax(&self) -> &SyntaxNode {
3446         &self.syntax
3447     }
3448 }
3449 impl TupleType {
3450     pub fn fields(&self) -> AstChildren<TypeRef> {
3451         AstChildren::new(&self.syntax)
3452     }
3453 }
3454 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3455 pub struct TypeAliasDef {
3456     pub(crate) syntax: SyntaxNode,
3457 }
3458 impl AstNode for TypeAliasDef {
3459     fn can_cast(kind: SyntaxKind) -> bool {
3460         match kind {
3461             TYPE_ALIAS_DEF => true,
3462             _ => false,
3463         }
3464     }
3465     fn cast(syntax: SyntaxNode) -> Option<Self> {
3466         if Self::can_cast(syntax.kind()) {
3467             Some(Self { syntax })
3468         } else {
3469             None
3470         }
3471     }
3472     fn syntax(&self) -> &SyntaxNode {
3473         &self.syntax
3474     }
3475 }
3476 impl ast::VisibilityOwner for TypeAliasDef {}
3477 impl ast::NameOwner for TypeAliasDef {}
3478 impl ast::TypeParamsOwner for TypeAliasDef {}
3479 impl ast::AttrsOwner for TypeAliasDef {}
3480 impl ast::DocCommentsOwner for TypeAliasDef {}
3481 impl ast::TypeBoundsOwner for TypeAliasDef {}
3482 impl TypeAliasDef {
3483     pub fn type_ref(&self) -> Option<TypeRef> {
3484         AstChildren::new(&self.syntax).next()
3485     }
3486 }
3487 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3488 pub struct TypeArg {
3489     pub(crate) syntax: SyntaxNode,
3490 }
3491 impl AstNode for TypeArg {
3492     fn can_cast(kind: SyntaxKind) -> bool {
3493         match kind {
3494             TYPE_ARG => true,
3495             _ => false,
3496         }
3497     }
3498     fn cast(syntax: SyntaxNode) -> Option<Self> {
3499         if Self::can_cast(syntax.kind()) {
3500             Some(Self { syntax })
3501         } else {
3502             None
3503         }
3504     }
3505     fn syntax(&self) -> &SyntaxNode {
3506         &self.syntax
3507     }
3508 }
3509 impl TypeArg {
3510     pub fn type_ref(&self) -> Option<TypeRef> {
3511         AstChildren::new(&self.syntax).next()
3512     }
3513 }
3514 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3515 pub struct TypeArgList {
3516     pub(crate) syntax: SyntaxNode,
3517 }
3518 impl AstNode for TypeArgList {
3519     fn can_cast(kind: SyntaxKind) -> bool {
3520         match kind {
3521             TYPE_ARG_LIST => true,
3522             _ => false,
3523         }
3524     }
3525     fn cast(syntax: SyntaxNode) -> Option<Self> {
3526         if Self::can_cast(syntax.kind()) {
3527             Some(Self { syntax })
3528         } else {
3529             None
3530         }
3531     }
3532     fn syntax(&self) -> &SyntaxNode {
3533         &self.syntax
3534     }
3535 }
3536 impl TypeArgList {
3537     pub fn type_args(&self) -> AstChildren<TypeArg> {
3538         AstChildren::new(&self.syntax)
3539     }
3540     pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> {
3541         AstChildren::new(&self.syntax)
3542     }
3543     pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> {
3544         AstChildren::new(&self.syntax)
3545     }
3546 }
3547 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3548 pub struct TypeBound {
3549     pub(crate) syntax: SyntaxNode,
3550 }
3551 impl AstNode for TypeBound {
3552     fn can_cast(kind: SyntaxKind) -> bool {
3553         match kind {
3554             TYPE_BOUND => true,
3555             _ => false,
3556         }
3557     }
3558     fn cast(syntax: SyntaxNode) -> Option<Self> {
3559         if Self::can_cast(syntax.kind()) {
3560             Some(Self { syntax })
3561         } else {
3562             None
3563         }
3564     }
3565     fn syntax(&self) -> &SyntaxNode {
3566         &self.syntax
3567     }
3568 }
3569 impl TypeBound {
3570     pub fn type_ref(&self) -> Option<TypeRef> {
3571         AstChildren::new(&self.syntax).next()
3572     }
3573 }
3574 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3575 pub struct TypeBoundList {
3576     pub(crate) syntax: SyntaxNode,
3577 }
3578 impl AstNode for TypeBoundList {
3579     fn can_cast(kind: SyntaxKind) -> bool {
3580         match kind {
3581             TYPE_BOUND_LIST => true,
3582             _ => false,
3583         }
3584     }
3585     fn cast(syntax: SyntaxNode) -> Option<Self> {
3586         if Self::can_cast(syntax.kind()) {
3587             Some(Self { syntax })
3588         } else {
3589             None
3590         }
3591     }
3592     fn syntax(&self) -> &SyntaxNode {
3593         &self.syntax
3594     }
3595 }
3596 impl TypeBoundList {
3597     pub fn bounds(&self) -> AstChildren<TypeBound> {
3598         AstChildren::new(&self.syntax)
3599     }
3600 }
3601 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3602 pub struct TypeParam {
3603     pub(crate) syntax: SyntaxNode,
3604 }
3605 impl AstNode for TypeParam {
3606     fn can_cast(kind: SyntaxKind) -> bool {
3607         match kind {
3608             TYPE_PARAM => true,
3609             _ => false,
3610         }
3611     }
3612     fn cast(syntax: SyntaxNode) -> Option<Self> {
3613         if Self::can_cast(syntax.kind()) {
3614             Some(Self { syntax })
3615         } else {
3616             None
3617         }
3618     }
3619     fn syntax(&self) -> &SyntaxNode {
3620         &self.syntax
3621     }
3622 }
3623 impl ast::NameOwner for TypeParam {}
3624 impl ast::AttrsOwner for TypeParam {}
3625 impl ast::TypeBoundsOwner for TypeParam {}
3626 impl ast::DefaultTypeParamOwner for TypeParam {}
3627 impl TypeParam {}
3628 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3629 pub struct TypeParamList {
3630     pub(crate) syntax: SyntaxNode,
3631 }
3632 impl AstNode for TypeParamList {
3633     fn can_cast(kind: SyntaxKind) -> bool {
3634         match kind {
3635             TYPE_PARAM_LIST => true,
3636             _ => false,
3637         }
3638     }
3639     fn cast(syntax: SyntaxNode) -> Option<Self> {
3640         if Self::can_cast(syntax.kind()) {
3641             Some(Self { syntax })
3642         } else {
3643             None
3644         }
3645     }
3646     fn syntax(&self) -> &SyntaxNode {
3647         &self.syntax
3648     }
3649 }
3650 impl TypeParamList {
3651     pub fn type_params(&self) -> AstChildren<TypeParam> {
3652         AstChildren::new(&self.syntax)
3653     }
3654     pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> {
3655         AstChildren::new(&self.syntax)
3656     }
3657 }
3658 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3659 pub enum TypeRef {
3660     ParenType(ParenType),
3661     TupleType(TupleType),
3662     NeverType(NeverType),
3663     PathType(PathType),
3664     PointerType(PointerType),
3665     ArrayType(ArrayType),
3666     SliceType(SliceType),
3667     ReferenceType(ReferenceType),
3668     PlaceholderType(PlaceholderType),
3669     FnPointerType(FnPointerType),
3670     ForType(ForType),
3671     ImplTraitType(ImplTraitType),
3672     DynTraitType(DynTraitType),
3673 }
3674 impl From<ParenType> for TypeRef {
3675     fn from(node: ParenType) -> TypeRef {
3676         TypeRef::ParenType(node)
3677     }
3678 }
3679 impl From<TupleType> for TypeRef {
3680     fn from(node: TupleType) -> TypeRef {
3681         TypeRef::TupleType(node)
3682     }
3683 }
3684 impl From<NeverType> for TypeRef {
3685     fn from(node: NeverType) -> TypeRef {
3686         TypeRef::NeverType(node)
3687     }
3688 }
3689 impl From<PathType> for TypeRef {
3690     fn from(node: PathType) -> TypeRef {
3691         TypeRef::PathType(node)
3692     }
3693 }
3694 impl From<PointerType> for TypeRef {
3695     fn from(node: PointerType) -> TypeRef {
3696         TypeRef::PointerType(node)
3697     }
3698 }
3699 impl From<ArrayType> for TypeRef {
3700     fn from(node: ArrayType) -> TypeRef {
3701         TypeRef::ArrayType(node)
3702     }
3703 }
3704 impl From<SliceType> for TypeRef {
3705     fn from(node: SliceType) -> TypeRef {
3706         TypeRef::SliceType(node)
3707     }
3708 }
3709 impl From<ReferenceType> for TypeRef {
3710     fn from(node: ReferenceType) -> TypeRef {
3711         TypeRef::ReferenceType(node)
3712     }
3713 }
3714 impl From<PlaceholderType> for TypeRef {
3715     fn from(node: PlaceholderType) -> TypeRef {
3716         TypeRef::PlaceholderType(node)
3717     }
3718 }
3719 impl From<FnPointerType> for TypeRef {
3720     fn from(node: FnPointerType) -> TypeRef {
3721         TypeRef::FnPointerType(node)
3722     }
3723 }
3724 impl From<ForType> for TypeRef {
3725     fn from(node: ForType) -> TypeRef {
3726         TypeRef::ForType(node)
3727     }
3728 }
3729 impl From<ImplTraitType> for TypeRef {
3730     fn from(node: ImplTraitType) -> TypeRef {
3731         TypeRef::ImplTraitType(node)
3732     }
3733 }
3734 impl From<DynTraitType> for TypeRef {
3735     fn from(node: DynTraitType) -> TypeRef {
3736         TypeRef::DynTraitType(node)
3737     }
3738 }
3739 impl AstNode for TypeRef {
3740     fn can_cast(kind: SyntaxKind) -> bool {
3741         match kind {
3742             PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
3743             | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE
3744             | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
3745             _ => false,
3746         }
3747     }
3748     fn cast(syntax: SyntaxNode) -> Option<Self> {
3749         let res = match syntax.kind() {
3750             PAREN_TYPE => TypeRef::ParenType(ParenType { syntax }),
3751             TUPLE_TYPE => TypeRef::TupleType(TupleType { syntax }),
3752             NEVER_TYPE => TypeRef::NeverType(NeverType { syntax }),
3753             PATH_TYPE => TypeRef::PathType(PathType { syntax }),
3754             POINTER_TYPE => TypeRef::PointerType(PointerType { syntax }),
3755             ARRAY_TYPE => TypeRef::ArrayType(ArrayType { syntax }),
3756             SLICE_TYPE => TypeRef::SliceType(SliceType { syntax }),
3757             REFERENCE_TYPE => TypeRef::ReferenceType(ReferenceType { syntax }),
3758             PLACEHOLDER_TYPE => TypeRef::PlaceholderType(PlaceholderType { syntax }),
3759             FN_POINTER_TYPE => TypeRef::FnPointerType(FnPointerType { syntax }),
3760             FOR_TYPE => TypeRef::ForType(ForType { syntax }),
3761             IMPL_TRAIT_TYPE => TypeRef::ImplTraitType(ImplTraitType { syntax }),
3762             DYN_TRAIT_TYPE => TypeRef::DynTraitType(DynTraitType { syntax }),
3763             _ => return None,
3764         };
3765         Some(res)
3766     }
3767     fn syntax(&self) -> &SyntaxNode {
3768         match self {
3769             TypeRef::ParenType(it) => &it.syntax,
3770             TypeRef::TupleType(it) => &it.syntax,
3771             TypeRef::NeverType(it) => &it.syntax,
3772             TypeRef::PathType(it) => &it.syntax,
3773             TypeRef::PointerType(it) => &it.syntax,
3774             TypeRef::ArrayType(it) => &it.syntax,
3775             TypeRef::SliceType(it) => &it.syntax,
3776             TypeRef::ReferenceType(it) => &it.syntax,
3777             TypeRef::PlaceholderType(it) => &it.syntax,
3778             TypeRef::FnPointerType(it) => &it.syntax,
3779             TypeRef::ForType(it) => &it.syntax,
3780             TypeRef::ImplTraitType(it) => &it.syntax,
3781             TypeRef::DynTraitType(it) => &it.syntax,
3782         }
3783     }
3784 }
3785 impl TypeRef {}
3786 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3787 pub struct UseItem {
3788     pub(crate) syntax: SyntaxNode,
3789 }
3790 impl AstNode for UseItem {
3791     fn can_cast(kind: SyntaxKind) -> bool {
3792         match kind {
3793             USE_ITEM => true,
3794             _ => false,
3795         }
3796     }
3797     fn cast(syntax: SyntaxNode) -> Option<Self> {
3798         if Self::can_cast(syntax.kind()) {
3799             Some(Self { syntax })
3800         } else {
3801             None
3802         }
3803     }
3804     fn syntax(&self) -> &SyntaxNode {
3805         &self.syntax
3806     }
3807 }
3808 impl ast::AttrsOwner for UseItem {}
3809 impl UseItem {
3810     pub fn use_tree(&self) -> Option<UseTree> {
3811         AstChildren::new(&self.syntax).next()
3812     }
3813 }
3814 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3815 pub struct UseTree {
3816     pub(crate) syntax: SyntaxNode,
3817 }
3818 impl AstNode for UseTree {
3819     fn can_cast(kind: SyntaxKind) -> bool {
3820         match kind {
3821             USE_TREE => true,
3822             _ => false,
3823         }
3824     }
3825     fn cast(syntax: SyntaxNode) -> Option<Self> {
3826         if Self::can_cast(syntax.kind()) {
3827             Some(Self { syntax })
3828         } else {
3829             None
3830         }
3831     }
3832     fn syntax(&self) -> &SyntaxNode {
3833         &self.syntax
3834     }
3835 }
3836 impl UseTree {
3837     pub fn path(&self) -> Option<Path> {
3838         AstChildren::new(&self.syntax).next()
3839     }
3840     pub fn use_tree_list(&self) -> Option<UseTreeList> {
3841         AstChildren::new(&self.syntax).next()
3842     }
3843     pub fn alias(&self) -> Option<Alias> {
3844         AstChildren::new(&self.syntax).next()
3845     }
3846 }
3847 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3848 pub struct UseTreeList {
3849     pub(crate) syntax: SyntaxNode,
3850 }
3851 impl AstNode for UseTreeList {
3852     fn can_cast(kind: SyntaxKind) -> bool {
3853         match kind {
3854             USE_TREE_LIST => 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 UseTreeList {
3870     pub fn use_trees(&self) -> AstChildren<UseTree> {
3871         AstChildren::new(&self.syntax)
3872     }
3873 }
3874 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3875 pub struct Visibility {
3876     pub(crate) syntax: SyntaxNode,
3877 }
3878 impl AstNode for Visibility {
3879     fn can_cast(kind: SyntaxKind) -> bool {
3880         match kind {
3881             VISIBILITY => true,
3882             _ => false,
3883         }
3884     }
3885     fn cast(syntax: SyntaxNode) -> Option<Self> {
3886         if Self::can_cast(syntax.kind()) {
3887             Some(Self { syntax })
3888         } else {
3889             None
3890         }
3891     }
3892     fn syntax(&self) -> &SyntaxNode {
3893         &self.syntax
3894     }
3895 }
3896 impl Visibility {}
3897 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3898 pub struct WhereClause {
3899     pub(crate) syntax: SyntaxNode,
3900 }
3901 impl AstNode for WhereClause {
3902     fn can_cast(kind: SyntaxKind) -> bool {
3903         match kind {
3904             WHERE_CLAUSE => true,
3905             _ => false,
3906         }
3907     }
3908     fn cast(syntax: SyntaxNode) -> Option<Self> {
3909         if Self::can_cast(syntax.kind()) {
3910             Some(Self { syntax })
3911         } else {
3912             None
3913         }
3914     }
3915     fn syntax(&self) -> &SyntaxNode {
3916         &self.syntax
3917     }
3918 }
3919 impl WhereClause {
3920     pub fn predicates(&self) -> AstChildren<WherePred> {
3921         AstChildren::new(&self.syntax)
3922     }
3923 }
3924 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3925 pub struct WherePred {
3926     pub(crate) syntax: SyntaxNode,
3927 }
3928 impl AstNode for WherePred {
3929     fn can_cast(kind: SyntaxKind) -> bool {
3930         match kind {
3931             WHERE_PRED => true,
3932             _ => false,
3933         }
3934     }
3935     fn cast(syntax: SyntaxNode) -> Option<Self> {
3936         if Self::can_cast(syntax.kind()) {
3937             Some(Self { syntax })
3938         } else {
3939             None
3940         }
3941     }
3942     fn syntax(&self) -> &SyntaxNode {
3943         &self.syntax
3944     }
3945 }
3946 impl ast::TypeBoundsOwner for WherePred {}
3947 impl WherePred {
3948     pub fn type_ref(&self) -> Option<TypeRef> {
3949         AstChildren::new(&self.syntax).next()
3950     }
3951 }
3952 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
3953 pub struct WhileExpr {
3954     pub(crate) syntax: SyntaxNode,
3955 }
3956 impl AstNode for WhileExpr {
3957     fn can_cast(kind: SyntaxKind) -> bool {
3958         match kind {
3959             WHILE_EXPR => true,
3960             _ => false,
3961         }
3962     }
3963     fn cast(syntax: SyntaxNode) -> Option<Self> {
3964         if Self::can_cast(syntax.kind()) {
3965             Some(Self { syntax })
3966         } else {
3967             None
3968         }
3969     }
3970     fn syntax(&self) -> &SyntaxNode {
3971         &self.syntax
3972     }
3973 }
3974 impl ast::LoopBodyOwner for WhileExpr {}
3975 impl WhileExpr {
3976     pub fn condition(&self) -> Option<Condition> {
3977         AstChildren::new(&self.syntax).next()
3978     }
3979 }