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