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