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