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