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