aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1089
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera11
2 files changed, 700 insertions, 400 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index b6a15dbdc..f77795d05 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -15,14 +15,17 @@ use crate::{
15pub struct ArgListNode(SyntaxNode); 15pub struct ArgListNode(SyntaxNode);
16 16
17impl ArgListNode { 17impl ArgListNode {
18 pub fn new(ast: ArgList) -> ArgListNode {
19 let syntax = ast.syntax().owned();
20 ArgListNode(syntax)
21 }
22 pub fn ast(&self) -> ArgList { 18 pub fn ast(&self) -> ArgList {
23 ArgList::cast(self.0.borrowed()).unwrap() 19 ArgList::cast(self.0.borrowed()).unwrap()
24 } 20 }
25} 21}
22
23impl<'a> From<ArgList<'a>> for ArgListNode {
24 fn from(ast: ArgList<'a>) -> ArgListNode {
25 let syntax = ast.syntax().owned();
26 ArgListNode(syntax)
27 }
28}
26#[derive(Debug, Clone, Copy)] 29#[derive(Debug, Clone, Copy)]
27pub struct ArgList<'a> { 30pub struct ArgList<'a> {
28 syntax: SyntaxNodeRef<'a>, 31 syntax: SyntaxNodeRef<'a>,
@@ -50,14 +53,17 @@ impl<'a> ArgList<'a> {
50pub struct ArrayExprNode(SyntaxNode); 53pub struct ArrayExprNode(SyntaxNode);
51 54
52impl ArrayExprNode { 55impl ArrayExprNode {
53 pub fn new(ast: ArrayExpr) -> ArrayExprNode {
54 let syntax = ast.syntax().owned();
55 ArrayExprNode(syntax)
56 }
57 pub fn ast(&self) -> ArrayExpr { 56 pub fn ast(&self) -> ArrayExpr {
58 ArrayExpr::cast(self.0.borrowed()).unwrap() 57 ArrayExpr::cast(self.0.borrowed()).unwrap()
59 } 58 }
60} 59}
60
61impl<'a> From<ArrayExpr<'a>> for ArrayExprNode {
62 fn from(ast: ArrayExpr<'a>) -> ArrayExprNode {
63 let syntax = ast.syntax().owned();
64 ArrayExprNode(syntax)
65 }
66}
61#[derive(Debug, Clone, Copy)] 67#[derive(Debug, Clone, Copy)]
62pub struct ArrayExpr<'a> { 68pub struct ArrayExpr<'a> {
63 syntax: SyntaxNodeRef<'a>, 69 syntax: SyntaxNodeRef<'a>,
@@ -81,14 +87,17 @@ impl<'a> ArrayExpr<'a> {}
81pub struct ArrayTypeNode(SyntaxNode); 87pub struct ArrayTypeNode(SyntaxNode);
82 88
83impl ArrayTypeNode { 89impl ArrayTypeNode {
84 pub fn new(ast: ArrayType) -> ArrayTypeNode {
85 let syntax = ast.syntax().owned();
86 ArrayTypeNode(syntax)
87 }
88 pub fn ast(&self) -> ArrayType { 90 pub fn ast(&self) -> ArrayType {
89 ArrayType::cast(self.0.borrowed()).unwrap() 91 ArrayType::cast(self.0.borrowed()).unwrap()
90 } 92 }
91} 93}
94
95impl<'a> From<ArrayType<'a>> for ArrayTypeNode {
96 fn from(ast: ArrayType<'a>) -> ArrayTypeNode {
97 let syntax = ast.syntax().owned();
98 ArrayTypeNode(syntax)
99 }
100}
92#[derive(Debug, Clone, Copy)] 101#[derive(Debug, Clone, Copy)]
93pub struct ArrayType<'a> { 102pub struct ArrayType<'a> {
94 syntax: SyntaxNodeRef<'a>, 103 syntax: SyntaxNodeRef<'a>,
@@ -112,14 +121,17 @@ impl<'a> ArrayType<'a> {}
112pub struct AttrNode(SyntaxNode); 121pub struct AttrNode(SyntaxNode);
113 122
114impl AttrNode { 123impl AttrNode {
115 pub fn new(ast: Attr) -> AttrNode {
116 let syntax = ast.syntax().owned();
117 AttrNode(syntax)
118 }
119 pub fn ast(&self) -> Attr { 124 pub fn ast(&self) -> Attr {
120 Attr::cast(self.0.borrowed()).unwrap() 125 Attr::cast(self.0.borrowed()).unwrap()
121 } 126 }
122} 127}
128
129impl<'a> From<Attr<'a>> for AttrNode {
130 fn from(ast: Attr<'a>) -> AttrNode {
131 let syntax = ast.syntax().owned();
132 AttrNode(syntax)
133 }
134}
123#[derive(Debug, Clone, Copy)] 135#[derive(Debug, Clone, Copy)]
124pub struct Attr<'a> { 136pub struct Attr<'a> {
125 syntax: SyntaxNodeRef<'a>, 137 syntax: SyntaxNodeRef<'a>,
@@ -147,14 +159,17 @@ impl<'a> Attr<'a> {
147pub struct BinExprNode(SyntaxNode); 159pub struct BinExprNode(SyntaxNode);
148 160
149impl BinExprNode { 161impl BinExprNode {
150 pub fn new(ast: BinExpr) -> BinExprNode {
151 let syntax = ast.syntax().owned();
152 BinExprNode(syntax)
153 }
154 pub fn ast(&self) -> BinExpr { 162 pub fn ast(&self) -> BinExpr {
155 BinExpr::cast(self.0.borrowed()).unwrap() 163 BinExpr::cast(self.0.borrowed()).unwrap()
156 } 164 }
157} 165}
166
167impl<'a> From<BinExpr<'a>> for BinExprNode {
168 fn from(ast: BinExpr<'a>) -> BinExprNode {
169 let syntax = ast.syntax().owned();
170 BinExprNode(syntax)
171 }
172}
158#[derive(Debug, Clone, Copy)] 173#[derive(Debug, Clone, Copy)]
159pub struct BinExpr<'a> { 174pub struct BinExpr<'a> {
160 syntax: SyntaxNodeRef<'a>, 175 syntax: SyntaxNodeRef<'a>,
@@ -178,14 +193,17 @@ impl<'a> BinExpr<'a> {}
178pub struct BindPatNode(SyntaxNode); 193pub struct BindPatNode(SyntaxNode);
179 194
180impl BindPatNode { 195impl BindPatNode {
181 pub fn new(ast: BindPat) -> BindPatNode {
182 let syntax = ast.syntax().owned();
183 BindPatNode(syntax)
184 }
185 pub fn ast(&self) -> BindPat { 196 pub fn ast(&self) -> BindPat {
186 BindPat::cast(self.0.borrowed()).unwrap() 197 BindPat::cast(self.0.borrowed()).unwrap()
187 } 198 }
188} 199}
200
201impl<'a> From<BindPat<'a>> for BindPatNode {
202 fn from(ast: BindPat<'a>) -> BindPatNode {
203 let syntax = ast.syntax().owned();
204 BindPatNode(syntax)
205 }
206}
189#[derive(Debug, Clone, Copy)] 207#[derive(Debug, Clone, Copy)]
190pub struct BindPat<'a> { 208pub struct BindPat<'a> {
191 syntax: SyntaxNodeRef<'a>, 209 syntax: SyntaxNodeRef<'a>,
@@ -210,14 +228,17 @@ impl<'a> BindPat<'a> {}
210pub struct BlockNode(SyntaxNode); 228pub struct BlockNode(SyntaxNode);
211 229
212impl BlockNode { 230impl BlockNode {
213 pub fn new(ast: Block) -> BlockNode {
214 let syntax = ast.syntax().owned();
215 BlockNode(syntax)
216 }
217 pub fn ast(&self) -> Block { 231 pub fn ast(&self) -> Block {
218 Block::cast(self.0.borrowed()).unwrap() 232 Block::cast(self.0.borrowed()).unwrap()
219 } 233 }
220} 234}
235
236impl<'a> From<Block<'a>> for BlockNode {
237 fn from(ast: Block<'a>) -> BlockNode {
238 let syntax = ast.syntax().owned();
239 BlockNode(syntax)
240 }
241}
221#[derive(Debug, Clone, Copy)] 242#[derive(Debug, Clone, Copy)]
222pub struct Block<'a> { 243pub struct Block<'a> {
223 syntax: SyntaxNodeRef<'a>, 244 syntax: SyntaxNodeRef<'a>,
@@ -249,14 +270,17 @@ impl<'a> Block<'a> {
249pub struct BlockExprNode(SyntaxNode); 270pub struct BlockExprNode(SyntaxNode);
250 271
251impl BlockExprNode { 272impl BlockExprNode {
252 pub fn new(ast: BlockExpr) -> BlockExprNode {
253 let syntax = ast.syntax().owned();
254 BlockExprNode(syntax)
255 }
256 pub fn ast(&self) -> BlockExpr { 273 pub fn ast(&self) -> BlockExpr {
257 BlockExpr::cast(self.0.borrowed()).unwrap() 274 BlockExpr::cast(self.0.borrowed()).unwrap()
258 } 275 }
259} 276}
277
278impl<'a> From<BlockExpr<'a>> for BlockExprNode {
279 fn from(ast: BlockExpr<'a>) -> BlockExprNode {
280 let syntax = ast.syntax().owned();
281 BlockExprNode(syntax)
282 }
283}
260#[derive(Debug, Clone, Copy)] 284#[derive(Debug, Clone, Copy)]
261pub struct BlockExpr<'a> { 285pub struct BlockExpr<'a> {
262 syntax: SyntaxNodeRef<'a>, 286 syntax: SyntaxNodeRef<'a>,
@@ -284,14 +308,17 @@ impl<'a> BlockExpr<'a> {
284pub struct BreakExprNode(SyntaxNode); 308pub struct BreakExprNode(SyntaxNode);
285 309
286impl BreakExprNode { 310impl BreakExprNode {
287 pub fn new(ast: BreakExpr) -> BreakExprNode {
288 let syntax = ast.syntax().owned();
289 BreakExprNode(syntax)
290 }
291 pub fn ast(&self) -> BreakExpr { 311 pub fn ast(&self) -> BreakExpr {
292 BreakExpr::cast(self.0.borrowed()).unwrap() 312 BreakExpr::cast(self.0.borrowed()).unwrap()
293 } 313 }
294} 314}
315
316impl<'a> From<BreakExpr<'a>> for BreakExprNode {
317 fn from(ast: BreakExpr<'a>) -> BreakExprNode {
318 let syntax = ast.syntax().owned();
319 BreakExprNode(syntax)
320 }
321}
295#[derive(Debug, Clone, Copy)] 322#[derive(Debug, Clone, Copy)]
296pub struct BreakExpr<'a> { 323pub struct BreakExpr<'a> {
297 syntax: SyntaxNodeRef<'a>, 324 syntax: SyntaxNodeRef<'a>,
@@ -315,14 +342,17 @@ impl<'a> BreakExpr<'a> {}
315pub struct CallExprNode(SyntaxNode); 342pub struct CallExprNode(SyntaxNode);
316 343
317impl CallExprNode { 344impl CallExprNode {
318 pub fn new(ast: CallExpr) -> CallExprNode {
319 let syntax = ast.syntax().owned();
320 CallExprNode(syntax)
321 }
322 pub fn ast(&self) -> CallExpr { 345 pub fn ast(&self) -> CallExpr {
323 CallExpr::cast(self.0.borrowed()).unwrap() 346 CallExpr::cast(self.0.borrowed()).unwrap()
324 } 347 }
325} 348}
349
350impl<'a> From<CallExpr<'a>> for CallExprNode {
351 fn from(ast: CallExpr<'a>) -> CallExprNode {
352 let syntax = ast.syntax().owned();
353 CallExprNode(syntax)
354 }
355}
326#[derive(Debug, Clone, Copy)] 356#[derive(Debug, Clone, Copy)]
327pub struct CallExpr<'a> { 357pub struct CallExpr<'a> {
328 syntax: SyntaxNodeRef<'a>, 358 syntax: SyntaxNodeRef<'a>,
@@ -351,14 +381,17 @@ impl<'a> CallExpr<'a> {
351pub struct CastExprNode(SyntaxNode); 381pub struct CastExprNode(SyntaxNode);
352 382
353impl CastExprNode { 383impl CastExprNode {
354 pub fn new(ast: CastExpr) -> CastExprNode {
355 let syntax = ast.syntax().owned();
356 CastExprNode(syntax)
357 }
358 pub fn ast(&self) -> CastExpr { 384 pub fn ast(&self) -> CastExpr {
359 CastExpr::cast(self.0.borrowed()).unwrap() 385 CastExpr::cast(self.0.borrowed()).unwrap()
360 } 386 }
361} 387}
388
389impl<'a> From<CastExpr<'a>> for CastExprNode {
390 fn from(ast: CastExpr<'a>) -> CastExprNode {
391 let syntax = ast.syntax().owned();
392 CastExprNode(syntax)
393 }
394}
362#[derive(Debug, Clone, Copy)] 395#[derive(Debug, Clone, Copy)]
363pub struct CastExpr<'a> { 396pub struct CastExpr<'a> {
364 syntax: SyntaxNodeRef<'a>, 397 syntax: SyntaxNodeRef<'a>,
@@ -382,14 +415,17 @@ impl<'a> CastExpr<'a> {}
382pub struct CommentNode(SyntaxNode); 415pub struct CommentNode(SyntaxNode);
383 416
384impl CommentNode { 417impl CommentNode {
385 pub fn new(ast: Comment) -> CommentNode {
386 let syntax = ast.syntax().owned();
387 CommentNode(syntax)
388 }
389 pub fn ast(&self) -> Comment { 418 pub fn ast(&self) -> Comment {
390 Comment::cast(self.0.borrowed()).unwrap() 419 Comment::cast(self.0.borrowed()).unwrap()
391 } 420 }
392} 421}
422
423impl<'a> From<Comment<'a>> for CommentNode {
424 fn from(ast: Comment<'a>) -> CommentNode {
425 let syntax = ast.syntax().owned();
426 CommentNode(syntax)
427 }
428}
393#[derive(Debug, Clone, Copy)] 429#[derive(Debug, Clone, Copy)]
394pub struct Comment<'a> { 430pub struct Comment<'a> {
395 syntax: SyntaxNodeRef<'a>, 431 syntax: SyntaxNodeRef<'a>,
@@ -413,14 +449,17 @@ impl<'a> Comment<'a> {}
413pub struct ConditionNode(SyntaxNode); 449pub struct ConditionNode(SyntaxNode);
414 450
415impl ConditionNode { 451impl ConditionNode {
416 pub fn new(ast: Condition) -> ConditionNode {
417 let syntax = ast.syntax().owned();
418 ConditionNode(syntax)
419 }
420 pub fn ast(&self) -> Condition { 452 pub fn ast(&self) -> Condition {
421 Condition::cast(self.0.borrowed()).unwrap() 453 Condition::cast(self.0.borrowed()).unwrap()
422 } 454 }
423} 455}
456
457impl<'a> From<Condition<'a>> for ConditionNode {
458 fn from(ast: Condition<'a>) -> ConditionNode {
459 let syntax = ast.syntax().owned();
460 ConditionNode(syntax)
461 }
462}
424#[derive(Debug, Clone, Copy)] 463#[derive(Debug, Clone, Copy)]
425pub struct Condition<'a> { 464pub struct Condition<'a> {
426 syntax: SyntaxNodeRef<'a>, 465 syntax: SyntaxNodeRef<'a>,
@@ -452,14 +491,17 @@ impl<'a> Condition<'a> {
452pub struct ConstDefNode(SyntaxNode); 491pub struct ConstDefNode(SyntaxNode);
453 492
454impl ConstDefNode { 493impl ConstDefNode {
455 pub fn new(ast: ConstDef) -> ConstDefNode {
456 let syntax = ast.syntax().owned();
457 ConstDefNode(syntax)
458 }
459 pub fn ast(&self) -> ConstDef { 494 pub fn ast(&self) -> ConstDef {
460 ConstDef::cast(self.0.borrowed()).unwrap() 495 ConstDef::cast(self.0.borrowed()).unwrap()
461 } 496 }
462} 497}
498
499impl<'a> From<ConstDef<'a>> for ConstDefNode {
500 fn from(ast: ConstDef<'a>) -> ConstDefNode {
501 let syntax = ast.syntax().owned();
502 ConstDefNode(syntax)
503 }
504}
463#[derive(Debug, Clone, Copy)] 505#[derive(Debug, Clone, Copy)]
464pub struct ConstDef<'a> { 506pub struct ConstDef<'a> {
465 syntax: SyntaxNodeRef<'a>, 507 syntax: SyntaxNodeRef<'a>,
@@ -486,14 +528,17 @@ impl<'a> ConstDef<'a> {}
486pub struct ContinueExprNode(SyntaxNode); 528pub struct ContinueExprNode(SyntaxNode);
487 529
488impl ContinueExprNode { 530impl ContinueExprNode {
489 pub fn new(ast: ContinueExpr) -> ContinueExprNode {
490 let syntax = ast.syntax().owned();
491 ContinueExprNode(syntax)
492 }
493 pub fn ast(&self) -> ContinueExpr { 531 pub fn ast(&self) -> ContinueExpr {
494 ContinueExpr::cast(self.0.borrowed()).unwrap() 532 ContinueExpr::cast(self.0.borrowed()).unwrap()
495 } 533 }
496} 534}
535
536impl<'a> From<ContinueExpr<'a>> for ContinueExprNode {
537 fn from(ast: ContinueExpr<'a>) -> ContinueExprNode {
538 let syntax = ast.syntax().owned();
539 ContinueExprNode(syntax)
540 }
541}
497#[derive(Debug, Clone, Copy)] 542#[derive(Debug, Clone, Copy)]
498pub struct ContinueExpr<'a> { 543pub struct ContinueExpr<'a> {
499 syntax: SyntaxNodeRef<'a>, 544 syntax: SyntaxNodeRef<'a>,
@@ -517,14 +562,17 @@ impl<'a> ContinueExpr<'a> {}
517pub struct DynTraitTypeNode(SyntaxNode); 562pub struct DynTraitTypeNode(SyntaxNode);
518 563
519impl DynTraitTypeNode { 564impl DynTraitTypeNode {
520 pub fn new(ast: DynTraitType) -> DynTraitTypeNode {
521 let syntax = ast.syntax().owned();
522 DynTraitTypeNode(syntax)
523 }
524 pub fn ast(&self) -> DynTraitType { 565 pub fn ast(&self) -> DynTraitType {
525 DynTraitType::cast(self.0.borrowed()).unwrap() 566 DynTraitType::cast(self.0.borrowed()).unwrap()
526 } 567 }
527} 568}
569
570impl<'a> From<DynTraitType<'a>> for DynTraitTypeNode {
571 fn from(ast: DynTraitType<'a>) -> DynTraitTypeNode {
572 let syntax = ast.syntax().owned();
573 DynTraitTypeNode(syntax)
574 }
575}
528#[derive(Debug, Clone, Copy)] 576#[derive(Debug, Clone, Copy)]
529pub struct DynTraitType<'a> { 577pub struct DynTraitType<'a> {
530 syntax: SyntaxNodeRef<'a>, 578 syntax: SyntaxNodeRef<'a>,
@@ -548,14 +596,17 @@ impl<'a> DynTraitType<'a> {}
548pub struct EnumDefNode(SyntaxNode); 596pub struct EnumDefNode(SyntaxNode);
549 597
550impl EnumDefNode { 598impl EnumDefNode {
551 pub fn new(ast: EnumDef) -> EnumDefNode {
552 let syntax = ast.syntax().owned();
553 EnumDefNode(syntax)
554 }
555 pub fn ast(&self) -> EnumDef { 599 pub fn ast(&self) -> EnumDef {
556 EnumDef::cast(self.0.borrowed()).unwrap() 600 EnumDef::cast(self.0.borrowed()).unwrap()
557 } 601 }
558} 602}
603
604impl<'a> From<EnumDef<'a>> for EnumDefNode {
605 fn from(ast: EnumDef<'a>) -> EnumDefNode {
606 let syntax = ast.syntax().owned();
607 EnumDefNode(syntax)
608 }
609}
559#[derive(Debug, Clone, Copy)] 610#[derive(Debug, Clone, Copy)]
560pub struct EnumDef<'a> { 611pub struct EnumDef<'a> {
561 syntax: SyntaxNodeRef<'a>, 612 syntax: SyntaxNodeRef<'a>,
@@ -582,14 +633,17 @@ impl<'a> EnumDef<'a> {}
582pub struct ExprNode(SyntaxNode); 633pub struct ExprNode(SyntaxNode);
583 634
584impl ExprNode { 635impl ExprNode {
585 pub fn new(ast: Expr) -> ExprNode {
586 let syntax = ast.syntax().owned();
587 ExprNode(syntax)
588 }
589 pub fn ast(&self) -> Expr { 636 pub fn ast(&self) -> Expr {
590 Expr::cast(self.0.borrowed()).unwrap() 637 Expr::cast(self.0.borrowed()).unwrap()
591 } 638 }
592} 639}
640
641impl<'a> From<Expr<'a>> for ExprNode {
642 fn from(ast: Expr<'a>) -> ExprNode {
643 let syntax = ast.syntax().owned();
644 ExprNode(syntax)
645 }
646}
593#[derive(Debug, Clone, Copy)] 647#[derive(Debug, Clone, Copy)]
594pub enum Expr<'a> { 648pub enum Expr<'a> {
595 TupleExpr(TupleExpr<'a>), 649 TupleExpr(TupleExpr<'a>),
@@ -710,14 +764,17 @@ impl<'a> Expr<'a> {}
710pub struct ExprStmtNode(SyntaxNode); 764pub struct ExprStmtNode(SyntaxNode);
711 765
712impl ExprStmtNode { 766impl ExprStmtNode {
713 pub fn new(ast: ExprStmt) -> ExprStmtNode {
714 let syntax = ast.syntax().owned();
715 ExprStmtNode(syntax)
716 }
717 pub fn ast(&self) -> ExprStmt { 767 pub fn ast(&self) -> ExprStmt {
718 ExprStmt::cast(self.0.borrowed()).unwrap() 768 ExprStmt::cast(self.0.borrowed()).unwrap()
719 } 769 }
720} 770}
771
772impl<'a> From<ExprStmt<'a>> for ExprStmtNode {
773 fn from(ast: ExprStmt<'a>) -> ExprStmtNode {
774 let syntax = ast.syntax().owned();
775 ExprStmtNode(syntax)
776 }
777}
721#[derive(Debug, Clone, Copy)] 778#[derive(Debug, Clone, Copy)]
722pub struct ExprStmt<'a> { 779pub struct ExprStmt<'a> {
723 syntax: SyntaxNodeRef<'a>, 780 syntax: SyntaxNodeRef<'a>,
@@ -745,14 +802,17 @@ impl<'a> ExprStmt<'a> {
745pub struct ExternCrateItemNode(SyntaxNode); 802pub struct ExternCrateItemNode(SyntaxNode);
746 803
747impl ExternCrateItemNode { 804impl ExternCrateItemNode {
748 pub fn new(ast: ExternCrateItem) -> ExternCrateItemNode {
749 let syntax = ast.syntax().owned();
750 ExternCrateItemNode(syntax)
751 }
752 pub fn ast(&self) -> ExternCrateItem { 805 pub fn ast(&self) -> ExternCrateItem {
753 ExternCrateItem::cast(self.0.borrowed()).unwrap() 806 ExternCrateItem::cast(self.0.borrowed()).unwrap()
754 } 807 }
755} 808}
809
810impl<'a> From<ExternCrateItem<'a>> for ExternCrateItemNode {
811 fn from(ast: ExternCrateItem<'a>) -> ExternCrateItemNode {
812 let syntax = ast.syntax().owned();
813 ExternCrateItemNode(syntax)
814 }
815}
756#[derive(Debug, Clone, Copy)] 816#[derive(Debug, Clone, Copy)]
757pub struct ExternCrateItem<'a> { 817pub struct ExternCrateItem<'a> {
758 syntax: SyntaxNodeRef<'a>, 818 syntax: SyntaxNodeRef<'a>,
@@ -776,14 +836,17 @@ impl<'a> ExternCrateItem<'a> {}
776pub struct FieldExprNode(SyntaxNode); 836pub struct FieldExprNode(SyntaxNode);
777 837
778impl FieldExprNode { 838impl FieldExprNode {
779 pub fn new(ast: FieldExpr) -> FieldExprNode {
780 let syntax = ast.syntax().owned();
781 FieldExprNode(syntax)
782 }
783 pub fn ast(&self) -> FieldExpr { 839 pub fn ast(&self) -> FieldExpr {
784 FieldExpr::cast(self.0.borrowed()).unwrap() 840 FieldExpr::cast(self.0.borrowed()).unwrap()
785 } 841 }
786} 842}
843
844impl<'a> From<FieldExpr<'a>> for FieldExprNode {
845 fn from(ast: FieldExpr<'a>) -> FieldExprNode {
846 let syntax = ast.syntax().owned();
847 FieldExprNode(syntax)
848 }
849}
787#[derive(Debug, Clone, Copy)] 850#[derive(Debug, Clone, Copy)]
788pub struct FieldExpr<'a> { 851pub struct FieldExpr<'a> {
789 syntax: SyntaxNodeRef<'a>, 852 syntax: SyntaxNodeRef<'a>,
@@ -807,14 +870,17 @@ impl<'a> FieldExpr<'a> {}
807pub struct FieldPatListNode(SyntaxNode); 870pub struct FieldPatListNode(SyntaxNode);
808 871
809impl FieldPatListNode { 872impl FieldPatListNode {
810 pub fn new(ast: FieldPatList) -> FieldPatListNode {
811 let syntax = ast.syntax().owned();
812 FieldPatListNode(syntax)
813 }
814 pub fn ast(&self) -> FieldPatList { 873 pub fn ast(&self) -> FieldPatList {
815 FieldPatList::cast(self.0.borrowed()).unwrap() 874 FieldPatList::cast(self.0.borrowed()).unwrap()
816 } 875 }
817} 876}
877
878impl<'a> From<FieldPatList<'a>> for FieldPatListNode {
879 fn from(ast: FieldPatList<'a>) -> FieldPatListNode {
880 let syntax = ast.syntax().owned();
881 FieldPatListNode(syntax)
882 }
883}
818#[derive(Debug, Clone, Copy)] 884#[derive(Debug, Clone, Copy)]
819pub struct FieldPatList<'a> { 885pub struct FieldPatList<'a> {
820 syntax: SyntaxNodeRef<'a>, 886 syntax: SyntaxNodeRef<'a>,
@@ -838,14 +904,17 @@ impl<'a> FieldPatList<'a> {}
838pub struct FnDefNode(SyntaxNode); 904pub struct FnDefNode(SyntaxNode);
839 905
840impl FnDefNode { 906impl FnDefNode {
841 pub fn new(ast: FnDef) -> FnDefNode {
842 let syntax = ast.syntax().owned();
843 FnDefNode(syntax)
844 }
845 pub fn ast(&self) -> FnDef { 907 pub fn ast(&self) -> FnDef {
846 FnDef::cast(self.0.borrowed()).unwrap() 908 FnDef::cast(self.0.borrowed()).unwrap()
847 } 909 }
848} 910}
911
912impl<'a> From<FnDef<'a>> for FnDefNode {
913 fn from(ast: FnDef<'a>) -> FnDefNode {
914 let syntax = ast.syntax().owned();
915 FnDefNode(syntax)
916 }
917}
849#[derive(Debug, Clone, Copy)] 918#[derive(Debug, Clone, Copy)]
850pub struct FnDef<'a> { 919pub struct FnDef<'a> {
851 syntax: SyntaxNodeRef<'a>, 920 syntax: SyntaxNodeRef<'a>,
@@ -885,14 +954,17 @@ impl<'a> FnDef<'a> {
885pub struct FnPointerTypeNode(SyntaxNode); 954pub struct FnPointerTypeNode(SyntaxNode);
886 955
887impl FnPointerTypeNode { 956impl FnPointerTypeNode {
888 pub fn new(ast: FnPointerType) -> FnPointerTypeNode {
889 let syntax = ast.syntax().owned();
890 FnPointerTypeNode(syntax)
891 }
892 pub fn ast(&self) -> FnPointerType { 957 pub fn ast(&self) -> FnPointerType {
893 FnPointerType::cast(self.0.borrowed()).unwrap() 958 FnPointerType::cast(self.0.borrowed()).unwrap()
894 } 959 }
895} 960}
961
962impl<'a> From<FnPointerType<'a>> for FnPointerTypeNode {
963 fn from(ast: FnPointerType<'a>) -> FnPointerTypeNode {
964 let syntax = ast.syntax().owned();
965 FnPointerTypeNode(syntax)
966 }
967}
896#[derive(Debug, Clone, Copy)] 968#[derive(Debug, Clone, Copy)]
897pub struct FnPointerType<'a> { 969pub struct FnPointerType<'a> {
898 syntax: SyntaxNodeRef<'a>, 970 syntax: SyntaxNodeRef<'a>,
@@ -916,14 +988,17 @@ impl<'a> FnPointerType<'a> {}
916pub struct ForExprNode(SyntaxNode); 988pub struct ForExprNode(SyntaxNode);
917 989
918impl ForExprNode { 990impl ForExprNode {
919 pub fn new(ast: ForExpr) -> ForExprNode {
920 let syntax = ast.syntax().owned();
921 ForExprNode(syntax)
922 }
923 pub fn ast(&self) -> ForExpr { 991 pub fn ast(&self) -> ForExpr {
924 ForExpr::cast(self.0.borrowed()).unwrap() 992 ForExpr::cast(self.0.borrowed()).unwrap()
925 } 993 }
926} 994}
995
996impl<'a> From<ForExpr<'a>> for ForExprNode {
997 fn from(ast: ForExpr<'a>) -> ForExprNode {
998 let syntax = ast.syntax().owned();
999 ForExprNode(syntax)
1000 }
1001}
927#[derive(Debug, Clone, Copy)] 1002#[derive(Debug, Clone, Copy)]
928pub struct ForExpr<'a> { 1003pub struct ForExpr<'a> {
929 syntax: SyntaxNodeRef<'a>, 1004 syntax: SyntaxNodeRef<'a>,
@@ -956,14 +1031,17 @@ impl<'a> ForExpr<'a> {
956pub struct ForTypeNode(SyntaxNode); 1031pub struct ForTypeNode(SyntaxNode);
957 1032
958impl ForTypeNode { 1033impl ForTypeNode {
959 pub fn new(ast: ForType) -> ForTypeNode {
960 let syntax = ast.syntax().owned();
961 ForTypeNode(syntax)
962 }
963 pub fn ast(&self) -> ForType { 1034 pub fn ast(&self) -> ForType {
964 ForType::cast(self.0.borrowed()).unwrap() 1035 ForType::cast(self.0.borrowed()).unwrap()
965 } 1036 }
966} 1037}
1038
1039impl<'a> From<ForType<'a>> for ForTypeNode {
1040 fn from(ast: ForType<'a>) -> ForTypeNode {
1041 let syntax = ast.syntax().owned();
1042 ForTypeNode(syntax)
1043 }
1044}
967#[derive(Debug, Clone, Copy)] 1045#[derive(Debug, Clone, Copy)]
968pub struct ForType<'a> { 1046pub struct ForType<'a> {
969 syntax: SyntaxNodeRef<'a>, 1047 syntax: SyntaxNodeRef<'a>,
@@ -987,14 +1065,17 @@ impl<'a> ForType<'a> {}
987pub struct IfExprNode(SyntaxNode); 1065pub struct IfExprNode(SyntaxNode);
988 1066
989impl IfExprNode { 1067impl IfExprNode {
990 pub fn new(ast: IfExpr) -> IfExprNode {
991 let syntax = ast.syntax().owned();
992 IfExprNode(syntax)
993 }
994 pub fn ast(&self) -> IfExpr { 1068 pub fn ast(&self) -> IfExpr {
995 IfExpr::cast(self.0.borrowed()).unwrap() 1069 IfExpr::cast(self.0.borrowed()).unwrap()
996 } 1070 }
997} 1071}
1072
1073impl<'a> From<IfExpr<'a>> for IfExprNode {
1074 fn from(ast: IfExpr<'a>) -> IfExprNode {
1075 let syntax = ast.syntax().owned();
1076 IfExprNode(syntax)
1077 }
1078}
998#[derive(Debug, Clone, Copy)] 1079#[derive(Debug, Clone, Copy)]
999pub struct IfExpr<'a> { 1080pub struct IfExpr<'a> {
1000 syntax: SyntaxNodeRef<'a>, 1081 syntax: SyntaxNodeRef<'a>,
@@ -1022,14 +1103,17 @@ impl<'a> IfExpr<'a> {
1022pub struct ImplItemNode(SyntaxNode); 1103pub struct ImplItemNode(SyntaxNode);
1023 1104
1024impl ImplItemNode { 1105impl ImplItemNode {
1025 pub fn new(ast: ImplItem) -> ImplItemNode {
1026 let syntax = ast.syntax().owned();
1027 ImplItemNode(syntax)
1028 }
1029 pub fn ast(&self) -> ImplItem { 1106 pub fn ast(&self) -> ImplItem {
1030 ImplItem::cast(self.0.borrowed()).unwrap() 1107 ImplItem::cast(self.0.borrowed()).unwrap()
1031 } 1108 }
1032} 1109}
1110
1111impl<'a> From<ImplItem<'a>> for ImplItemNode {
1112 fn from(ast: ImplItem<'a>) -> ImplItemNode {
1113 let syntax = ast.syntax().owned();
1114 ImplItemNode(syntax)
1115 }
1116}
1033#[derive(Debug, Clone, Copy)] 1117#[derive(Debug, Clone, Copy)]
1034pub struct ImplItem<'a> { 1118pub struct ImplItem<'a> {
1035 syntax: SyntaxNodeRef<'a>, 1119 syntax: SyntaxNodeRef<'a>,
@@ -1053,14 +1137,17 @@ impl<'a> ImplItem<'a> {}
1053pub struct ImplTraitTypeNode(SyntaxNode); 1137pub struct ImplTraitTypeNode(SyntaxNode);
1054 1138
1055impl ImplTraitTypeNode { 1139impl ImplTraitTypeNode {
1056 pub fn new(ast: ImplTraitType) -> ImplTraitTypeNode {
1057 let syntax = ast.syntax().owned();
1058 ImplTraitTypeNode(syntax)
1059 }
1060 pub fn ast(&self) -> ImplTraitType { 1140 pub fn ast(&self) -> ImplTraitType {
1061 ImplTraitType::cast(self.0.borrowed()).unwrap() 1141 ImplTraitType::cast(self.0.borrowed()).unwrap()
1062 } 1142 }
1063} 1143}
1144
1145impl<'a> From<ImplTraitType<'a>> for ImplTraitTypeNode {
1146 fn from(ast: ImplTraitType<'a>) -> ImplTraitTypeNode {
1147 let syntax = ast.syntax().owned();
1148 ImplTraitTypeNode(syntax)
1149 }
1150}
1064#[derive(Debug, Clone, Copy)] 1151#[derive(Debug, Clone, Copy)]
1065pub struct ImplTraitType<'a> { 1152pub struct ImplTraitType<'a> {
1066 syntax: SyntaxNodeRef<'a>, 1153 syntax: SyntaxNodeRef<'a>,
@@ -1084,14 +1171,17 @@ impl<'a> ImplTraitType<'a> {}
1084pub struct IndexExprNode(SyntaxNode); 1171pub struct IndexExprNode(SyntaxNode);
1085 1172
1086impl IndexExprNode { 1173impl IndexExprNode {
1087 pub fn new(ast: IndexExpr) -> IndexExprNode {
1088 let syntax = ast.syntax().owned();
1089 IndexExprNode(syntax)
1090 }
1091 pub fn ast(&self) -> IndexExpr { 1174 pub fn ast(&self) -> IndexExpr {
1092 IndexExpr::cast(self.0.borrowed()).unwrap() 1175 IndexExpr::cast(self.0.borrowed()).unwrap()
1093 } 1176 }
1094} 1177}
1178
1179impl<'a> From<IndexExpr<'a>> for IndexExprNode {
1180 fn from(ast: IndexExpr<'a>) -> IndexExprNode {
1181 let syntax = ast.syntax().owned();
1182 IndexExprNode(syntax)
1183 }
1184}
1095#[derive(Debug, Clone, Copy)] 1185#[derive(Debug, Clone, Copy)]
1096pub struct IndexExpr<'a> { 1186pub struct IndexExpr<'a> {
1097 syntax: SyntaxNodeRef<'a>, 1187 syntax: SyntaxNodeRef<'a>,
@@ -1115,14 +1205,17 @@ impl<'a> IndexExpr<'a> {}
1115pub struct ItemListNode(SyntaxNode); 1205pub struct ItemListNode(SyntaxNode);
1116 1206
1117impl ItemListNode { 1207impl ItemListNode {
1118 pub fn new(ast: ItemList) -> ItemListNode {
1119 let syntax = ast.syntax().owned();
1120 ItemListNode(syntax)
1121 }
1122 pub fn ast(&self) -> ItemList { 1208 pub fn ast(&self) -> ItemList {
1123 ItemList::cast(self.0.borrowed()).unwrap() 1209 ItemList::cast(self.0.borrowed()).unwrap()
1124 } 1210 }
1125} 1211}
1212
1213impl<'a> From<ItemList<'a>> for ItemListNode {
1214 fn from(ast: ItemList<'a>) -> ItemListNode {
1215 let syntax = ast.syntax().owned();
1216 ItemListNode(syntax)
1217 }
1218}
1126#[derive(Debug, Clone, Copy)] 1219#[derive(Debug, Clone, Copy)]
1127pub struct ItemList<'a> { 1220pub struct ItemList<'a> {
1128 syntax: SyntaxNodeRef<'a>, 1221 syntax: SyntaxNodeRef<'a>,
@@ -1148,14 +1241,17 @@ impl<'a> ItemList<'a> {}
1148pub struct LabelNode(SyntaxNode); 1241pub struct LabelNode(SyntaxNode);
1149 1242
1150impl LabelNode { 1243impl LabelNode {
1151 pub fn new(ast: Label) -> LabelNode {
1152 let syntax = ast.syntax().owned();
1153 LabelNode(syntax)
1154 }
1155 pub fn ast(&self) -> Label { 1244 pub fn ast(&self) -> Label {
1156 Label::cast(self.0.borrowed()).unwrap() 1245 Label::cast(self.0.borrowed()).unwrap()
1157 } 1246 }
1158} 1247}
1248
1249impl<'a> From<Label<'a>> for LabelNode {
1250 fn from(ast: Label<'a>) -> LabelNode {
1251 let syntax = ast.syntax().owned();
1252 LabelNode(syntax)
1253 }
1254}
1159#[derive(Debug, Clone, Copy)] 1255#[derive(Debug, Clone, Copy)]
1160pub struct Label<'a> { 1256pub struct Label<'a> {
1161 syntax: SyntaxNodeRef<'a>, 1257 syntax: SyntaxNodeRef<'a>,
@@ -1179,14 +1275,17 @@ impl<'a> Label<'a> {}
1179pub struct LambdaExprNode(SyntaxNode); 1275pub struct LambdaExprNode(SyntaxNode);
1180 1276
1181impl LambdaExprNode { 1277impl LambdaExprNode {
1182 pub fn new(ast: LambdaExpr) -> LambdaExprNode {
1183 let syntax = ast.syntax().owned();
1184 LambdaExprNode(syntax)
1185 }
1186 pub fn ast(&self) -> LambdaExpr { 1278 pub fn ast(&self) -> LambdaExpr {
1187 LambdaExpr::cast(self.0.borrowed()).unwrap() 1279 LambdaExpr::cast(self.0.borrowed()).unwrap()
1188 } 1280 }
1189} 1281}
1282
1283impl<'a> From<LambdaExpr<'a>> for LambdaExprNode {
1284 fn from(ast: LambdaExpr<'a>) -> LambdaExprNode {
1285 let syntax = ast.syntax().owned();
1286 LambdaExprNode(syntax)
1287 }
1288}
1190#[derive(Debug, Clone, Copy)] 1289#[derive(Debug, Clone, Copy)]
1191pub struct LambdaExpr<'a> { 1290pub struct LambdaExpr<'a> {
1192 syntax: SyntaxNodeRef<'a>, 1291 syntax: SyntaxNodeRef<'a>,
@@ -1218,14 +1317,17 @@ impl<'a> LambdaExpr<'a> {
1218pub struct LetStmtNode(SyntaxNode); 1317pub struct LetStmtNode(SyntaxNode);
1219 1318
1220impl LetStmtNode { 1319impl LetStmtNode {
1221 pub fn new(ast: LetStmt) -> LetStmtNode {
1222 let syntax = ast.syntax().owned();
1223 LetStmtNode(syntax)
1224 }
1225 pub fn ast(&self) -> LetStmt { 1320 pub fn ast(&self) -> LetStmt {
1226 LetStmt::cast(self.0.borrowed()).unwrap() 1321 LetStmt::cast(self.0.borrowed()).unwrap()
1227 } 1322 }
1228} 1323}
1324
1325impl<'a> From<LetStmt<'a>> for LetStmtNode {
1326 fn from(ast: LetStmt<'a>) -> LetStmtNode {
1327 let syntax = ast.syntax().owned();
1328 LetStmtNode(syntax)
1329 }
1330}
1229#[derive(Debug, Clone, Copy)] 1331#[derive(Debug, Clone, Copy)]
1230pub struct LetStmt<'a> { 1332pub struct LetStmt<'a> {
1231 syntax: SyntaxNodeRef<'a>, 1333 syntax: SyntaxNodeRef<'a>,
@@ -1257,14 +1359,17 @@ impl<'a> LetStmt<'a> {
1257pub struct LifetimeNode(SyntaxNode); 1359pub struct LifetimeNode(SyntaxNode);
1258 1360
1259impl LifetimeNode { 1361impl LifetimeNode {
1260 pub fn new(ast: Lifetime) -> LifetimeNode {
1261 let syntax = ast.syntax().owned();
1262 LifetimeNode(syntax)
1263 }
1264 pub fn ast(&self) -> Lifetime { 1362 pub fn ast(&self) -> Lifetime {
1265 Lifetime::cast(self.0.borrowed()).unwrap() 1363 Lifetime::cast(self.0.borrowed()).unwrap()
1266 } 1364 }
1267} 1365}
1366
1367impl<'a> From<Lifetime<'a>> for LifetimeNode {
1368 fn from(ast: Lifetime<'a>) -> LifetimeNode {
1369 let syntax = ast.syntax().owned();
1370 LifetimeNode(syntax)
1371 }
1372}
1268#[derive(Debug, Clone, Copy)] 1373#[derive(Debug, Clone, Copy)]
1269pub struct Lifetime<'a> { 1374pub struct Lifetime<'a> {
1270 syntax: SyntaxNodeRef<'a>, 1375 syntax: SyntaxNodeRef<'a>,
@@ -1288,14 +1393,17 @@ impl<'a> Lifetime<'a> {}
1288pub struct LifetimeParamNode(SyntaxNode); 1393pub struct LifetimeParamNode(SyntaxNode);
1289 1394
1290impl LifetimeParamNode { 1395impl LifetimeParamNode {
1291 pub fn new(ast: LifetimeParam) -> LifetimeParamNode {
1292 let syntax = ast.syntax().owned();
1293 LifetimeParamNode(syntax)
1294 }
1295 pub fn ast(&self) -> LifetimeParam { 1396 pub fn ast(&self) -> LifetimeParam {
1296 LifetimeParam::cast(self.0.borrowed()).unwrap() 1397 LifetimeParam::cast(self.0.borrowed()).unwrap()
1297 } 1398 }
1298} 1399}
1400
1401impl<'a> From<LifetimeParam<'a>> for LifetimeParamNode {
1402 fn from(ast: LifetimeParam<'a>) -> LifetimeParamNode {
1403 let syntax = ast.syntax().owned();
1404 LifetimeParamNode(syntax)
1405 }
1406}
1299#[derive(Debug, Clone, Copy)] 1407#[derive(Debug, Clone, Copy)]
1300pub struct LifetimeParam<'a> { 1408pub struct LifetimeParam<'a> {
1301 syntax: SyntaxNodeRef<'a>, 1409 syntax: SyntaxNodeRef<'a>,
@@ -1323,14 +1431,17 @@ impl<'a> LifetimeParam<'a> {
1323pub struct LiteralNode(SyntaxNode); 1431pub struct LiteralNode(SyntaxNode);
1324 1432
1325impl LiteralNode { 1433impl LiteralNode {
1326 pub fn new(ast: Literal) -> LiteralNode {
1327 let syntax = ast.syntax().owned();
1328 LiteralNode(syntax)
1329 }
1330 pub fn ast(&self) -> Literal { 1434 pub fn ast(&self) -> Literal {
1331 Literal::cast(self.0.borrowed()).unwrap() 1435 Literal::cast(self.0.borrowed()).unwrap()
1332 } 1436 }
1333} 1437}
1438
1439impl<'a> From<Literal<'a>> for LiteralNode {
1440 fn from(ast: Literal<'a>) -> LiteralNode {
1441 let syntax = ast.syntax().owned();
1442 LiteralNode(syntax)
1443 }
1444}
1334#[derive(Debug, Clone, Copy)] 1445#[derive(Debug, Clone, Copy)]
1335pub struct Literal<'a> { 1446pub struct Literal<'a> {
1336 syntax: SyntaxNodeRef<'a>, 1447 syntax: SyntaxNodeRef<'a>,
@@ -1354,14 +1465,17 @@ impl<'a> Literal<'a> {}
1354pub struct LoopExprNode(SyntaxNode); 1465pub struct LoopExprNode(SyntaxNode);
1355 1466
1356impl LoopExprNode { 1467impl LoopExprNode {
1357 pub fn new(ast: LoopExpr) -> LoopExprNode {
1358 let syntax = ast.syntax().owned();
1359 LoopExprNode(syntax)
1360 }
1361 pub fn ast(&self) -> LoopExpr { 1468 pub fn ast(&self) -> LoopExpr {
1362 LoopExpr::cast(self.0.borrowed()).unwrap() 1469 LoopExpr::cast(self.0.borrowed()).unwrap()
1363 } 1470 }
1364} 1471}
1472
1473impl<'a> From<LoopExpr<'a>> for LoopExprNode {
1474 fn from(ast: LoopExpr<'a>) -> LoopExprNode {
1475 let syntax = ast.syntax().owned();
1476 LoopExprNode(syntax)
1477 }
1478}
1365#[derive(Debug, Clone, Copy)] 1479#[derive(Debug, Clone, Copy)]
1366pub struct LoopExpr<'a> { 1480pub struct LoopExpr<'a> {
1367 syntax: SyntaxNodeRef<'a>, 1481 syntax: SyntaxNodeRef<'a>,
@@ -1386,14 +1500,17 @@ impl<'a> LoopExpr<'a> {}
1386pub struct MatchArmNode(SyntaxNode); 1500pub struct MatchArmNode(SyntaxNode);
1387 1501
1388impl MatchArmNode { 1502impl MatchArmNode {
1389 pub fn new(ast: MatchArm) -> MatchArmNode {
1390 let syntax = ast.syntax().owned();
1391 MatchArmNode(syntax)
1392 }
1393 pub fn ast(&self) -> MatchArm { 1503 pub fn ast(&self) -> MatchArm {
1394 MatchArm::cast(self.0.borrowed()).unwrap() 1504 MatchArm::cast(self.0.borrowed()).unwrap()
1395 } 1505 }
1396} 1506}
1507
1508impl<'a> From<MatchArm<'a>> for MatchArmNode {
1509 fn from(ast: MatchArm<'a>) -> MatchArmNode {
1510 let syntax = ast.syntax().owned();
1511 MatchArmNode(syntax)
1512 }
1513}
1397#[derive(Debug, Clone, Copy)] 1514#[derive(Debug, Clone, Copy)]
1398pub struct MatchArm<'a> { 1515pub struct MatchArm<'a> {
1399 syntax: SyntaxNodeRef<'a>, 1516 syntax: SyntaxNodeRef<'a>,
@@ -1429,14 +1546,17 @@ impl<'a> MatchArm<'a> {
1429pub struct MatchArmListNode(SyntaxNode); 1546pub struct MatchArmListNode(SyntaxNode);
1430 1547
1431impl MatchArmListNode { 1548impl MatchArmListNode {
1432 pub fn new(ast: MatchArmList) -> MatchArmListNode {
1433 let syntax = ast.syntax().owned();
1434 MatchArmListNode(syntax)
1435 }
1436 pub fn ast(&self) -> MatchArmList { 1549 pub fn ast(&self) -> MatchArmList {
1437 MatchArmList::cast(self.0.borrowed()).unwrap() 1550 MatchArmList::cast(self.0.borrowed()).unwrap()
1438 } 1551 }
1439} 1552}
1553
1554impl<'a> From<MatchArmList<'a>> for MatchArmListNode {
1555 fn from(ast: MatchArmList<'a>) -> MatchArmListNode {
1556 let syntax = ast.syntax().owned();
1557 MatchArmListNode(syntax)
1558 }
1559}
1440#[derive(Debug, Clone, Copy)] 1560#[derive(Debug, Clone, Copy)]
1441pub struct MatchArmList<'a> { 1561pub struct MatchArmList<'a> {
1442 syntax: SyntaxNodeRef<'a>, 1562 syntax: SyntaxNodeRef<'a>,
@@ -1464,14 +1584,17 @@ impl<'a> MatchArmList<'a> {
1464pub struct MatchExprNode(SyntaxNode); 1584pub struct MatchExprNode(SyntaxNode);
1465 1585
1466impl MatchExprNode { 1586impl MatchExprNode {
1467 pub fn new(ast: MatchExpr) -> MatchExprNode {
1468 let syntax = ast.syntax().owned();
1469 MatchExprNode(syntax)
1470 }
1471 pub fn ast(&self) -> MatchExpr { 1587 pub fn ast(&self) -> MatchExpr {
1472 MatchExpr::cast(self.0.borrowed()).unwrap() 1588 MatchExpr::cast(self.0.borrowed()).unwrap()
1473 } 1589 }
1474} 1590}
1591
1592impl<'a> From<MatchExpr<'a>> for MatchExprNode {
1593 fn from(ast: MatchExpr<'a>) -> MatchExprNode {
1594 let syntax = ast.syntax().owned();
1595 MatchExprNode(syntax)
1596 }
1597}
1475#[derive(Debug, Clone, Copy)] 1598#[derive(Debug, Clone, Copy)]
1476pub struct MatchExpr<'a> { 1599pub struct MatchExpr<'a> {
1477 syntax: SyntaxNodeRef<'a>, 1600 syntax: SyntaxNodeRef<'a>,
@@ -1503,14 +1626,17 @@ impl<'a> MatchExpr<'a> {
1503pub struct MatchGuardNode(SyntaxNode); 1626pub struct MatchGuardNode(SyntaxNode);
1504 1627
1505impl MatchGuardNode { 1628impl MatchGuardNode {
1506 pub fn new(ast: MatchGuard) -> MatchGuardNode {
1507 let syntax = ast.syntax().owned();
1508 MatchGuardNode(syntax)
1509 }
1510 pub fn ast(&self) -> MatchGuard { 1629 pub fn ast(&self) -> MatchGuard {
1511 MatchGuard::cast(self.0.borrowed()).unwrap() 1630 MatchGuard::cast(self.0.borrowed()).unwrap()
1512 } 1631 }
1513} 1632}
1633
1634impl<'a> From<MatchGuard<'a>> for MatchGuardNode {
1635 fn from(ast: MatchGuard<'a>) -> MatchGuardNode {
1636 let syntax = ast.syntax().owned();
1637 MatchGuardNode(syntax)
1638 }
1639}
1514#[derive(Debug, Clone, Copy)] 1640#[derive(Debug, Clone, Copy)]
1515pub struct MatchGuard<'a> { 1641pub struct MatchGuard<'a> {
1516 syntax: SyntaxNodeRef<'a>, 1642 syntax: SyntaxNodeRef<'a>,
@@ -1534,14 +1660,17 @@ impl<'a> MatchGuard<'a> {}
1534pub struct MethodCallExprNode(SyntaxNode); 1660pub struct MethodCallExprNode(SyntaxNode);
1535 1661
1536impl MethodCallExprNode { 1662impl MethodCallExprNode {
1537 pub fn new(ast: MethodCallExpr) -> MethodCallExprNode {
1538 let syntax = ast.syntax().owned();
1539 MethodCallExprNode(syntax)
1540 }
1541 pub fn ast(&self) -> MethodCallExpr { 1663 pub fn ast(&self) -> MethodCallExpr {
1542 MethodCallExpr::cast(self.0.borrowed()).unwrap() 1664 MethodCallExpr::cast(self.0.borrowed()).unwrap()
1543 } 1665 }
1544} 1666}
1667
1668impl<'a> From<MethodCallExpr<'a>> for MethodCallExprNode {
1669 fn from(ast: MethodCallExpr<'a>) -> MethodCallExprNode {
1670 let syntax = ast.syntax().owned();
1671 MethodCallExprNode(syntax)
1672 }
1673}
1545#[derive(Debug, Clone, Copy)] 1674#[derive(Debug, Clone, Copy)]
1546pub struct MethodCallExpr<'a> { 1675pub struct MethodCallExpr<'a> {
1547 syntax: SyntaxNodeRef<'a>, 1676 syntax: SyntaxNodeRef<'a>,
@@ -1570,14 +1699,17 @@ impl<'a> MethodCallExpr<'a> {
1570pub struct ModuleNode(SyntaxNode); 1699pub struct ModuleNode(SyntaxNode);
1571 1700
1572impl ModuleNode { 1701impl ModuleNode {
1573 pub fn new(ast: Module) -> ModuleNode {
1574 let syntax = ast.syntax().owned();
1575 ModuleNode(syntax)
1576 }
1577 pub fn ast(&self) -> Module { 1702 pub fn ast(&self) -> Module {
1578 Module::cast(self.0.borrowed()).unwrap() 1703 Module::cast(self.0.borrowed()).unwrap()
1579 } 1704 }
1580} 1705}
1706
1707impl<'a> From<Module<'a>> for ModuleNode {
1708 fn from(ast: Module<'a>) -> ModuleNode {
1709 let syntax = ast.syntax().owned();
1710 ModuleNode(syntax)
1711 }
1712}
1581#[derive(Debug, Clone, Copy)] 1713#[derive(Debug, Clone, Copy)]
1582pub struct Module<'a> { 1714pub struct Module<'a> {
1583 syntax: SyntaxNodeRef<'a>, 1715 syntax: SyntaxNodeRef<'a>,
@@ -1607,14 +1739,17 @@ impl<'a> Module<'a> {
1607pub struct ModuleItemNode(SyntaxNode); 1739pub struct ModuleItemNode(SyntaxNode);
1608 1740
1609impl ModuleItemNode { 1741impl ModuleItemNode {
1610 pub fn new(ast: ModuleItem) -> ModuleItemNode {
1611 let syntax = ast.syntax().owned();
1612 ModuleItemNode(syntax)
1613 }
1614 pub fn ast(&self) -> ModuleItem { 1742 pub fn ast(&self) -> ModuleItem {
1615 ModuleItem::cast(self.0.borrowed()).unwrap() 1743 ModuleItem::cast(self.0.borrowed()).unwrap()
1616 } 1744 }
1617} 1745}
1746
1747impl<'a> From<ModuleItem<'a>> for ModuleItemNode {
1748 fn from(ast: ModuleItem<'a>) -> ModuleItemNode {
1749 let syntax = ast.syntax().owned();
1750 ModuleItemNode(syntax)
1751 }
1752}
1618#[derive(Debug, Clone, Copy)] 1753#[derive(Debug, Clone, Copy)]
1619pub enum ModuleItem<'a> { 1754pub enum ModuleItem<'a> {
1620 StructDef(StructDef<'a>), 1755 StructDef(StructDef<'a>),
@@ -1672,14 +1807,17 @@ impl<'a> ModuleItem<'a> {}
1672pub struct NameNode(SyntaxNode); 1807pub struct NameNode(SyntaxNode);
1673 1808
1674impl NameNode { 1809impl NameNode {
1675 pub fn new(ast: Name) -> NameNode {
1676 let syntax = ast.syntax().owned();
1677 NameNode(syntax)
1678 }
1679 pub fn ast(&self) -> Name { 1810 pub fn ast(&self) -> Name {
1680 Name::cast(self.0.borrowed()).unwrap() 1811 Name::cast(self.0.borrowed()).unwrap()
1681 } 1812 }
1682} 1813}
1814
1815impl<'a> From<Name<'a>> for NameNode {
1816 fn from(ast: Name<'a>) -> NameNode {
1817 let syntax = ast.syntax().owned();
1818 NameNode(syntax)
1819 }
1820}
1683#[derive(Debug, Clone, Copy)] 1821#[derive(Debug, Clone, Copy)]
1684pub struct Name<'a> { 1822pub struct Name<'a> {
1685 syntax: SyntaxNodeRef<'a>, 1823 syntax: SyntaxNodeRef<'a>,
@@ -1703,14 +1841,17 @@ impl<'a> Name<'a> {}
1703pub struct NameRefNode(SyntaxNode); 1841pub struct NameRefNode(SyntaxNode);
1704 1842
1705impl NameRefNode { 1843impl NameRefNode {
1706 pub fn new(ast: NameRef) -> NameRefNode {
1707 let syntax = ast.syntax().owned();
1708 NameRefNode(syntax)
1709 }
1710 pub fn ast(&self) -> NameRef { 1844 pub fn ast(&self) -> NameRef {
1711 NameRef::cast(self.0.borrowed()).unwrap() 1845 NameRef::cast(self.0.borrowed()).unwrap()
1712 } 1846 }
1713} 1847}
1848
1849impl<'a> From<NameRef<'a>> for NameRefNode {
1850 fn from(ast: NameRef<'a>) -> NameRefNode {
1851 let syntax = ast.syntax().owned();
1852 NameRefNode(syntax)
1853 }
1854}
1714#[derive(Debug, Clone, Copy)] 1855#[derive(Debug, Clone, Copy)]
1715pub struct NameRef<'a> { 1856pub struct NameRef<'a> {
1716 syntax: SyntaxNodeRef<'a>, 1857 syntax: SyntaxNodeRef<'a>,
@@ -1734,14 +1875,17 @@ impl<'a> NameRef<'a> {}
1734pub struct NamedFieldNode(SyntaxNode); 1875pub struct NamedFieldNode(SyntaxNode);
1735 1876
1736impl NamedFieldNode { 1877impl NamedFieldNode {
1737 pub fn new(ast: NamedField) -> NamedFieldNode {
1738 let syntax = ast.syntax().owned();
1739 NamedFieldNode(syntax)
1740 }
1741 pub fn ast(&self) -> NamedField { 1878 pub fn ast(&self) -> NamedField {
1742 NamedField::cast(self.0.borrowed()).unwrap() 1879 NamedField::cast(self.0.borrowed()).unwrap()
1743 } 1880 }
1744} 1881}
1882
1883impl<'a> From<NamedField<'a>> for NamedFieldNode {
1884 fn from(ast: NamedField<'a>) -> NamedFieldNode {
1885 let syntax = ast.syntax().owned();
1886 NamedFieldNode(syntax)
1887 }
1888}
1745#[derive(Debug, Clone, Copy)] 1889#[derive(Debug, Clone, Copy)]
1746pub struct NamedField<'a> { 1890pub struct NamedField<'a> {
1747 syntax: SyntaxNodeRef<'a>, 1891 syntax: SyntaxNodeRef<'a>,
@@ -1765,14 +1909,17 @@ impl<'a> NamedField<'a> {}
1765pub struct NamedFieldDefNode(SyntaxNode); 1909pub struct NamedFieldDefNode(SyntaxNode);
1766 1910
1767impl NamedFieldDefNode { 1911impl NamedFieldDefNode {
1768 pub fn new(ast: NamedFieldDef) -> NamedFieldDefNode {
1769 let syntax = ast.syntax().owned();
1770 NamedFieldDefNode(syntax)
1771 }
1772 pub fn ast(&self) -> NamedFieldDef { 1912 pub fn ast(&self) -> NamedFieldDef {
1773 NamedFieldDef::cast(self.0.borrowed()).unwrap() 1913 NamedFieldDef::cast(self.0.borrowed()).unwrap()
1774 } 1914 }
1775} 1915}
1916
1917impl<'a> From<NamedFieldDef<'a>> for NamedFieldDefNode {
1918 fn from(ast: NamedFieldDef<'a>) -> NamedFieldDefNode {
1919 let syntax = ast.syntax().owned();
1920 NamedFieldDefNode(syntax)
1921 }
1922}
1776#[derive(Debug, Clone, Copy)] 1923#[derive(Debug, Clone, Copy)]
1777pub struct NamedFieldDef<'a> { 1924pub struct NamedFieldDef<'a> {
1778 syntax: SyntaxNodeRef<'a>, 1925 syntax: SyntaxNodeRef<'a>,
@@ -1798,14 +1945,17 @@ impl<'a> NamedFieldDef<'a> {}
1798pub struct NamedFieldListNode(SyntaxNode); 1945pub struct NamedFieldListNode(SyntaxNode);
1799 1946
1800impl NamedFieldListNode { 1947impl NamedFieldListNode {
1801 pub fn new(ast: NamedFieldList) -> NamedFieldListNode {
1802 let syntax = ast.syntax().owned();
1803 NamedFieldListNode(syntax)
1804 }
1805 pub fn ast(&self) -> NamedFieldList { 1948 pub fn ast(&self) -> NamedFieldList {
1806 NamedFieldList::cast(self.0.borrowed()).unwrap() 1949 NamedFieldList::cast(self.0.borrowed()).unwrap()
1807 } 1950 }
1808} 1951}
1952
1953impl<'a> From<NamedFieldList<'a>> for NamedFieldListNode {
1954 fn from(ast: NamedFieldList<'a>) -> NamedFieldListNode {
1955 let syntax = ast.syntax().owned();
1956 NamedFieldListNode(syntax)
1957 }
1958}
1809#[derive(Debug, Clone, Copy)] 1959#[derive(Debug, Clone, Copy)]
1810pub struct NamedFieldList<'a> { 1960pub struct NamedFieldList<'a> {
1811 syntax: SyntaxNodeRef<'a>, 1961 syntax: SyntaxNodeRef<'a>,
@@ -1829,14 +1979,17 @@ impl<'a> NamedFieldList<'a> {}
1829pub struct NeverTypeNode(SyntaxNode); 1979pub struct NeverTypeNode(SyntaxNode);
1830 1980
1831impl NeverTypeNode { 1981impl NeverTypeNode {
1832 pub fn new(ast: NeverType) -> NeverTypeNode {
1833 let syntax = ast.syntax().owned();
1834 NeverTypeNode(syntax)
1835 }
1836 pub fn ast(&self) -> NeverType { 1982 pub fn ast(&self) -> NeverType {
1837 NeverType::cast(self.0.borrowed()).unwrap() 1983 NeverType::cast(self.0.borrowed()).unwrap()
1838 } 1984 }
1839} 1985}
1986
1987impl<'a> From<NeverType<'a>> for NeverTypeNode {
1988 fn from(ast: NeverType<'a>) -> NeverTypeNode {
1989 let syntax = ast.syntax().owned();
1990 NeverTypeNode(syntax)
1991 }
1992}
1840#[derive(Debug, Clone, Copy)] 1993#[derive(Debug, Clone, Copy)]
1841pub struct NeverType<'a> { 1994pub struct NeverType<'a> {
1842 syntax: SyntaxNodeRef<'a>, 1995 syntax: SyntaxNodeRef<'a>,
@@ -1860,14 +2013,17 @@ impl<'a> NeverType<'a> {}
1860pub struct NominalDefNode(SyntaxNode); 2013pub struct NominalDefNode(SyntaxNode);
1861 2014
1862impl NominalDefNode { 2015impl NominalDefNode {
1863 pub fn new(ast: NominalDef) -> NominalDefNode {
1864 let syntax = ast.syntax().owned();
1865 NominalDefNode(syntax)
1866 }
1867 pub fn ast(&self) -> NominalDef { 2016 pub fn ast(&self) -> NominalDef {
1868 NominalDef::cast(self.0.borrowed()).unwrap() 2017 NominalDef::cast(self.0.borrowed()).unwrap()
1869 } 2018 }
1870} 2019}
2020
2021impl<'a> From<NominalDef<'a>> for NominalDefNode {
2022 fn from(ast: NominalDef<'a>) -> NominalDefNode {
2023 let syntax = ast.syntax().owned();
2024 NominalDefNode(syntax)
2025 }
2026}
1871#[derive(Debug, Clone, Copy)] 2027#[derive(Debug, Clone, Copy)]
1872pub enum NominalDef<'a> { 2028pub enum NominalDef<'a> {
1873 StructDef(StructDef<'a>), 2029 StructDef(StructDef<'a>),
@@ -1901,14 +2057,17 @@ impl<'a> NominalDef<'a> {}
1901pub struct ParamNode(SyntaxNode); 2057pub struct ParamNode(SyntaxNode);
1902 2058
1903impl ParamNode { 2059impl ParamNode {
1904 pub fn new(ast: Param) -> ParamNode {
1905 let syntax = ast.syntax().owned();
1906 ParamNode(syntax)
1907 }
1908 pub fn ast(&self) -> Param { 2060 pub fn ast(&self) -> Param {
1909 Param::cast(self.0.borrowed()).unwrap() 2061 Param::cast(self.0.borrowed()).unwrap()
1910 } 2062 }
1911} 2063}
2064
2065impl<'a> From<Param<'a>> for ParamNode {
2066 fn from(ast: Param<'a>) -> ParamNode {
2067 let syntax = ast.syntax().owned();
2068 ParamNode(syntax)
2069 }
2070}
1912#[derive(Debug, Clone, Copy)] 2071#[derive(Debug, Clone, Copy)]
1913pub struct Param<'a> { 2072pub struct Param<'a> {
1914 syntax: SyntaxNodeRef<'a>, 2073 syntax: SyntaxNodeRef<'a>,
@@ -1936,14 +2095,17 @@ impl<'a> Param<'a> {
1936pub struct ParamListNode(SyntaxNode); 2095pub struct ParamListNode(SyntaxNode);
1937 2096
1938impl ParamListNode { 2097impl ParamListNode {
1939 pub fn new(ast: ParamList) -> ParamListNode {
1940 let syntax = ast.syntax().owned();
1941 ParamListNode(syntax)
1942 }
1943 pub fn ast(&self) -> ParamList { 2098 pub fn ast(&self) -> ParamList {
1944 ParamList::cast(self.0.borrowed()).unwrap() 2099 ParamList::cast(self.0.borrowed()).unwrap()
1945 } 2100 }
1946} 2101}
2102
2103impl<'a> From<ParamList<'a>> for ParamListNode {
2104 fn from(ast: ParamList<'a>) -> ParamListNode {
2105 let syntax = ast.syntax().owned();
2106 ParamListNode(syntax)
2107 }
2108}
1947#[derive(Debug, Clone, Copy)] 2109#[derive(Debug, Clone, Copy)]
1948pub struct ParamList<'a> { 2110pub struct ParamList<'a> {
1949 syntax: SyntaxNodeRef<'a>, 2111 syntax: SyntaxNodeRef<'a>,
@@ -1975,14 +2137,17 @@ impl<'a> ParamList<'a> {
1975pub struct ParenExprNode(SyntaxNode); 2137pub struct ParenExprNode(SyntaxNode);
1976 2138
1977impl ParenExprNode { 2139impl ParenExprNode {
1978 pub fn new(ast: ParenExpr) -> ParenExprNode {
1979 let syntax = ast.syntax().owned();
1980 ParenExprNode(syntax)
1981 }
1982 pub fn ast(&self) -> ParenExpr { 2140 pub fn ast(&self) -> ParenExpr {
1983 ParenExpr::cast(self.0.borrowed()).unwrap() 2141 ParenExpr::cast(self.0.borrowed()).unwrap()
1984 } 2142 }
1985} 2143}
2144
2145impl<'a> From<ParenExpr<'a>> for ParenExprNode {
2146 fn from(ast: ParenExpr<'a>) -> ParenExprNode {
2147 let syntax = ast.syntax().owned();
2148 ParenExprNode(syntax)
2149 }
2150}
1986#[derive(Debug, Clone, Copy)] 2151#[derive(Debug, Clone, Copy)]
1987pub struct ParenExpr<'a> { 2152pub struct ParenExpr<'a> {
1988 syntax: SyntaxNodeRef<'a>, 2153 syntax: SyntaxNodeRef<'a>,
@@ -2006,14 +2171,17 @@ impl<'a> ParenExpr<'a> {}
2006pub struct ParenTypeNode(SyntaxNode); 2171pub struct ParenTypeNode(SyntaxNode);
2007 2172
2008impl ParenTypeNode { 2173impl ParenTypeNode {
2009 pub fn new(ast: ParenType) -> ParenTypeNode {
2010 let syntax = ast.syntax().owned();
2011 ParenTypeNode(syntax)
2012 }
2013 pub fn ast(&self) -> ParenType { 2174 pub fn ast(&self) -> ParenType {
2014 ParenType::cast(self.0.borrowed()).unwrap() 2175 ParenType::cast(self.0.borrowed()).unwrap()
2015 } 2176 }
2016} 2177}
2178
2179impl<'a> From<ParenType<'a>> for ParenTypeNode {
2180 fn from(ast: ParenType<'a>) -> ParenTypeNode {
2181 let syntax = ast.syntax().owned();
2182 ParenTypeNode(syntax)
2183 }
2184}
2017#[derive(Debug, Clone, Copy)] 2185#[derive(Debug, Clone, Copy)]
2018pub struct ParenType<'a> { 2186pub struct ParenType<'a> {
2019 syntax: SyntaxNodeRef<'a>, 2187 syntax: SyntaxNodeRef<'a>,
@@ -2037,14 +2205,17 @@ impl<'a> ParenType<'a> {}
2037pub struct PatNode(SyntaxNode); 2205pub struct PatNode(SyntaxNode);
2038 2206
2039impl PatNode { 2207impl PatNode {
2040 pub fn new(ast: Pat) -> PatNode {
2041 let syntax = ast.syntax().owned();
2042 PatNode(syntax)
2043 }
2044 pub fn ast(&self) -> Pat { 2208 pub fn ast(&self) -> Pat {
2045 Pat::cast(self.0.borrowed()).unwrap() 2209 Pat::cast(self.0.borrowed()).unwrap()
2046 } 2210 }
2047} 2211}
2212
2213impl<'a> From<Pat<'a>> for PatNode {
2214 fn from(ast: Pat<'a>) -> PatNode {
2215 let syntax = ast.syntax().owned();
2216 PatNode(syntax)
2217 }
2218}
2048#[derive(Debug, Clone, Copy)] 2219#[derive(Debug, Clone, Copy)]
2049pub enum Pat<'a> { 2220pub enum Pat<'a> {
2050 RefPat(RefPat<'a>), 2221 RefPat(RefPat<'a>),
@@ -2099,14 +2270,17 @@ impl<'a> Pat<'a> {}
2099pub struct PathNode(SyntaxNode); 2270pub struct PathNode(SyntaxNode);
2100 2271
2101impl PathNode { 2272impl PathNode {
2102 pub fn new(ast: Path) -> PathNode {
2103 let syntax = ast.syntax().owned();
2104 PathNode(syntax)
2105 }
2106 pub fn ast(&self) -> Path { 2273 pub fn ast(&self) -> Path {
2107 Path::cast(self.0.borrowed()).unwrap() 2274 Path::cast(self.0.borrowed()).unwrap()
2108 } 2275 }
2109} 2276}
2277
2278impl<'a> From<Path<'a>> for PathNode {
2279 fn from(ast: Path<'a>) -> PathNode {
2280 let syntax = ast.syntax().owned();
2281 PathNode(syntax)
2282 }
2283}
2110#[derive(Debug, Clone, Copy)] 2284#[derive(Debug, Clone, Copy)]
2111pub struct Path<'a> { 2285pub struct Path<'a> {
2112 syntax: SyntaxNodeRef<'a>, 2286 syntax: SyntaxNodeRef<'a>,
@@ -2138,14 +2312,17 @@ impl<'a> Path<'a> {
2138pub struct PathExprNode(SyntaxNode); 2312pub struct PathExprNode(SyntaxNode);
2139 2313
2140impl PathExprNode { 2314impl PathExprNode {
2141 pub fn new(ast: PathExpr) -> PathExprNode {
2142 let syntax = ast.syntax().owned();
2143 PathExprNode(syntax)
2144 }
2145 pub fn ast(&self) -> PathExpr { 2315 pub fn ast(&self) -> PathExpr {
2146 PathExpr::cast(self.0.borrowed()).unwrap() 2316 PathExpr::cast(self.0.borrowed()).unwrap()
2147 } 2317 }
2148} 2318}
2319
2320impl<'a> From<PathExpr<'a>> for PathExprNode {
2321 fn from(ast: PathExpr<'a>) -> PathExprNode {
2322 let syntax = ast.syntax().owned();
2323 PathExprNode(syntax)
2324 }
2325}
2149#[derive(Debug, Clone, Copy)] 2326#[derive(Debug, Clone, Copy)]
2150pub struct PathExpr<'a> { 2327pub struct PathExpr<'a> {
2151 syntax: SyntaxNodeRef<'a>, 2328 syntax: SyntaxNodeRef<'a>,
@@ -2173,14 +2350,17 @@ impl<'a> PathExpr<'a> {
2173pub struct PathPatNode(SyntaxNode); 2350pub struct PathPatNode(SyntaxNode);
2174 2351
2175impl PathPatNode { 2352impl PathPatNode {
2176 pub fn new(ast: PathPat) -> PathPatNode {
2177 let syntax = ast.syntax().owned();
2178 PathPatNode(syntax)
2179 }
2180 pub fn ast(&self) -> PathPat { 2353 pub fn ast(&self) -> PathPat {
2181 PathPat::cast(self.0.borrowed()).unwrap() 2354 PathPat::cast(self.0.borrowed()).unwrap()
2182 } 2355 }
2183} 2356}
2357
2358impl<'a> From<PathPat<'a>> for PathPatNode {
2359 fn from(ast: PathPat<'a>) -> PathPatNode {
2360 let syntax = ast.syntax().owned();
2361 PathPatNode(syntax)
2362 }
2363}
2184#[derive(Debug, Clone, Copy)] 2364#[derive(Debug, Clone, Copy)]
2185pub struct PathPat<'a> { 2365pub struct PathPat<'a> {
2186 syntax: SyntaxNodeRef<'a>, 2366 syntax: SyntaxNodeRef<'a>,
@@ -2204,14 +2384,17 @@ impl<'a> PathPat<'a> {}
2204pub struct PathSegmentNode(SyntaxNode); 2384pub struct PathSegmentNode(SyntaxNode);
2205 2385
2206impl PathSegmentNode { 2386impl PathSegmentNode {
2207 pub fn new(ast: PathSegment) -> PathSegmentNode {
2208 let syntax = ast.syntax().owned();
2209 PathSegmentNode(syntax)
2210 }
2211 pub fn ast(&self) -> PathSegment { 2387 pub fn ast(&self) -> PathSegment {
2212 PathSegment::cast(self.0.borrowed()).unwrap() 2388 PathSegment::cast(self.0.borrowed()).unwrap()
2213 } 2389 }
2214} 2390}
2391
2392impl<'a> From<PathSegment<'a>> for PathSegmentNode {
2393 fn from(ast: PathSegment<'a>) -> PathSegmentNode {
2394 let syntax = ast.syntax().owned();
2395 PathSegmentNode(syntax)
2396 }
2397}
2215#[derive(Debug, Clone, Copy)] 2398#[derive(Debug, Clone, Copy)]
2216pub struct PathSegment<'a> { 2399pub struct PathSegment<'a> {
2217 syntax: SyntaxNodeRef<'a>, 2400 syntax: SyntaxNodeRef<'a>,
@@ -2239,14 +2422,17 @@ impl<'a> PathSegment<'a> {
2239pub struct PathTypeNode(SyntaxNode); 2422pub struct PathTypeNode(SyntaxNode);
2240 2423
2241impl PathTypeNode { 2424impl PathTypeNode {
2242 pub fn new(ast: PathType) -> PathTypeNode {
2243 let syntax = ast.syntax().owned();
2244 PathTypeNode(syntax)
2245 }
2246 pub fn ast(&self) -> PathType { 2425 pub fn ast(&self) -> PathType {
2247 PathType::cast(self.0.borrowed()).unwrap() 2426 PathType::cast(self.0.borrowed()).unwrap()
2248 } 2427 }
2249} 2428}
2429
2430impl<'a> From<PathType<'a>> for PathTypeNode {
2431 fn from(ast: PathType<'a>) -> PathTypeNode {
2432 let syntax = ast.syntax().owned();
2433 PathTypeNode(syntax)
2434 }
2435}
2250#[derive(Debug, Clone, Copy)] 2436#[derive(Debug, Clone, Copy)]
2251pub struct PathType<'a> { 2437pub struct PathType<'a> {
2252 syntax: SyntaxNodeRef<'a>, 2438 syntax: SyntaxNodeRef<'a>,
@@ -2270,14 +2456,17 @@ impl<'a> PathType<'a> {}
2270pub struct PlaceholderPatNode(SyntaxNode); 2456pub struct PlaceholderPatNode(SyntaxNode);
2271 2457
2272impl PlaceholderPatNode { 2458impl PlaceholderPatNode {
2273 pub fn new(ast: PlaceholderPat) -> PlaceholderPatNode {
2274 let syntax = ast.syntax().owned();
2275 PlaceholderPatNode(syntax)
2276 }
2277 pub fn ast(&self) -> PlaceholderPat { 2459 pub fn ast(&self) -> PlaceholderPat {
2278 PlaceholderPat::cast(self.0.borrowed()).unwrap() 2460 PlaceholderPat::cast(self.0.borrowed()).unwrap()
2279 } 2461 }
2280} 2462}
2463
2464impl<'a> From<PlaceholderPat<'a>> for PlaceholderPatNode {
2465 fn from(ast: PlaceholderPat<'a>) -> PlaceholderPatNode {
2466 let syntax = ast.syntax().owned();
2467 PlaceholderPatNode(syntax)
2468 }
2469}
2281#[derive(Debug, Clone, Copy)] 2470#[derive(Debug, Clone, Copy)]
2282pub struct PlaceholderPat<'a> { 2471pub struct PlaceholderPat<'a> {
2283 syntax: SyntaxNodeRef<'a>, 2472 syntax: SyntaxNodeRef<'a>,
@@ -2301,14 +2490,17 @@ impl<'a> PlaceholderPat<'a> {}
2301pub struct PlaceholderTypeNode(SyntaxNode); 2490pub struct PlaceholderTypeNode(SyntaxNode);
2302 2491
2303impl PlaceholderTypeNode { 2492impl PlaceholderTypeNode {
2304 pub fn new(ast: PlaceholderType) -> PlaceholderTypeNode {
2305 let syntax = ast.syntax().owned();
2306 PlaceholderTypeNode(syntax)
2307 }
2308 pub fn ast(&self) -> PlaceholderType { 2493 pub fn ast(&self) -> PlaceholderType {
2309 PlaceholderType::cast(self.0.borrowed()).unwrap() 2494 PlaceholderType::cast(self.0.borrowed()).unwrap()
2310 } 2495 }
2311} 2496}
2497
2498impl<'a> From<PlaceholderType<'a>> for PlaceholderTypeNode {
2499 fn from(ast: PlaceholderType<'a>) -> PlaceholderTypeNode {
2500 let syntax = ast.syntax().owned();
2501 PlaceholderTypeNode(syntax)
2502 }
2503}
2312#[derive(Debug, Clone, Copy)] 2504#[derive(Debug, Clone, Copy)]
2313pub struct PlaceholderType<'a> { 2505pub struct PlaceholderType<'a> {
2314 syntax: SyntaxNodeRef<'a>, 2506 syntax: SyntaxNodeRef<'a>,
@@ -2332,14 +2524,17 @@ impl<'a> PlaceholderType<'a> {}
2332pub struct PointerTypeNode(SyntaxNode); 2524pub struct PointerTypeNode(SyntaxNode);
2333 2525
2334impl PointerTypeNode { 2526impl PointerTypeNode {
2335 pub fn new(ast: PointerType) -> PointerTypeNode {
2336 let syntax = ast.syntax().owned();
2337 PointerTypeNode(syntax)
2338 }
2339 pub fn ast(&self) -> PointerType { 2527 pub fn ast(&self) -> PointerType {
2340 PointerType::cast(self.0.borrowed()).unwrap() 2528 PointerType::cast(self.0.borrowed()).unwrap()
2341 } 2529 }
2342} 2530}
2531
2532impl<'a> From<PointerType<'a>> for PointerTypeNode {
2533 fn from(ast: PointerType<'a>) -> PointerTypeNode {
2534 let syntax = ast.syntax().owned();
2535 PointerTypeNode(syntax)
2536 }
2537}
2343#[derive(Debug, Clone, Copy)] 2538#[derive(Debug, Clone, Copy)]
2344pub struct PointerType<'a> { 2539pub struct PointerType<'a> {
2345 syntax: SyntaxNodeRef<'a>, 2540 syntax: SyntaxNodeRef<'a>,
@@ -2363,14 +2558,17 @@ impl<'a> PointerType<'a> {}
2363pub struct PrefixExprNode(SyntaxNode); 2558pub struct PrefixExprNode(SyntaxNode);
2364 2559
2365impl PrefixExprNode { 2560impl PrefixExprNode {
2366 pub fn new(ast: PrefixExpr) -> PrefixExprNode {
2367 let syntax = ast.syntax().owned();
2368 PrefixExprNode(syntax)
2369 }
2370 pub fn ast(&self) -> PrefixExpr { 2561 pub fn ast(&self) -> PrefixExpr {
2371 PrefixExpr::cast(self.0.borrowed()).unwrap() 2562 PrefixExpr::cast(self.0.borrowed()).unwrap()
2372 } 2563 }
2373} 2564}
2565
2566impl<'a> From<PrefixExpr<'a>> for PrefixExprNode {
2567 fn from(ast: PrefixExpr<'a>) -> PrefixExprNode {
2568 let syntax = ast.syntax().owned();
2569 PrefixExprNode(syntax)
2570 }
2571}
2374#[derive(Debug, Clone, Copy)] 2572#[derive(Debug, Clone, Copy)]
2375pub struct PrefixExpr<'a> { 2573pub struct PrefixExpr<'a> {
2376 syntax: SyntaxNodeRef<'a>, 2574 syntax: SyntaxNodeRef<'a>,
@@ -2394,14 +2592,17 @@ impl<'a> PrefixExpr<'a> {}
2394pub struct RangeExprNode(SyntaxNode); 2592pub struct RangeExprNode(SyntaxNode);
2395 2593
2396impl RangeExprNode { 2594impl RangeExprNode {
2397 pub fn new(ast: RangeExpr) -> RangeExprNode {
2398 let syntax = ast.syntax().owned();
2399 RangeExprNode(syntax)
2400 }
2401 pub fn ast(&self) -> RangeExpr { 2595 pub fn ast(&self) -> RangeExpr {
2402 RangeExpr::cast(self.0.borrowed()).unwrap() 2596 RangeExpr::cast(self.0.borrowed()).unwrap()
2403 } 2597 }
2404} 2598}
2599
2600impl<'a> From<RangeExpr<'a>> for RangeExprNode {
2601 fn from(ast: RangeExpr<'a>) -> RangeExprNode {
2602 let syntax = ast.syntax().owned();
2603 RangeExprNode(syntax)
2604 }
2605}
2405#[derive(Debug, Clone, Copy)] 2606#[derive(Debug, Clone, Copy)]
2406pub struct RangeExpr<'a> { 2607pub struct RangeExpr<'a> {
2407 syntax: SyntaxNodeRef<'a>, 2608 syntax: SyntaxNodeRef<'a>,
@@ -2425,14 +2626,17 @@ impl<'a> RangeExpr<'a> {}
2425pub struct RangePatNode(SyntaxNode); 2626pub struct RangePatNode(SyntaxNode);
2426 2627
2427impl RangePatNode { 2628impl RangePatNode {
2428 pub fn new(ast: RangePat) -> RangePatNode {
2429 let syntax = ast.syntax().owned();
2430 RangePatNode(syntax)
2431 }
2432 pub fn ast(&self) -> RangePat { 2629 pub fn ast(&self) -> RangePat {
2433 RangePat::cast(self.0.borrowed()).unwrap() 2630 RangePat::cast(self.0.borrowed()).unwrap()
2434 } 2631 }
2435} 2632}
2633
2634impl<'a> From<RangePat<'a>> for RangePatNode {
2635 fn from(ast: RangePat<'a>) -> RangePatNode {
2636 let syntax = ast.syntax().owned();
2637 RangePatNode(syntax)
2638 }
2639}
2436#[derive(Debug, Clone, Copy)] 2640#[derive(Debug, Clone, Copy)]
2437pub struct RangePat<'a> { 2641pub struct RangePat<'a> {
2438 syntax: SyntaxNodeRef<'a>, 2642 syntax: SyntaxNodeRef<'a>,
@@ -2456,14 +2660,17 @@ impl<'a> RangePat<'a> {}
2456pub struct RefExprNode(SyntaxNode); 2660pub struct RefExprNode(SyntaxNode);
2457 2661
2458impl RefExprNode { 2662impl RefExprNode {
2459 pub fn new(ast: RefExpr) -> RefExprNode {
2460 let syntax = ast.syntax().owned();
2461 RefExprNode(syntax)
2462 }
2463 pub fn ast(&self) -> RefExpr { 2663 pub fn ast(&self) -> RefExpr {
2464 RefExpr::cast(self.0.borrowed()).unwrap() 2664 RefExpr::cast(self.0.borrowed()).unwrap()
2465 } 2665 }
2466} 2666}
2667
2668impl<'a> From<RefExpr<'a>> for RefExprNode {
2669 fn from(ast: RefExpr<'a>) -> RefExprNode {
2670 let syntax = ast.syntax().owned();
2671 RefExprNode(syntax)
2672 }
2673}
2467#[derive(Debug, Clone, Copy)] 2674#[derive(Debug, Clone, Copy)]
2468pub struct RefExpr<'a> { 2675pub struct RefExpr<'a> {
2469 syntax: SyntaxNodeRef<'a>, 2676 syntax: SyntaxNodeRef<'a>,
@@ -2487,14 +2694,17 @@ impl<'a> RefExpr<'a> {}
2487pub struct RefPatNode(SyntaxNode); 2694pub struct RefPatNode(SyntaxNode);
2488 2695
2489impl RefPatNode { 2696impl RefPatNode {
2490 pub fn new(ast: RefPat) -> RefPatNode {
2491 let syntax = ast.syntax().owned();
2492 RefPatNode(syntax)
2493 }
2494 pub fn ast(&self) -> RefPat { 2697 pub fn ast(&self) -> RefPat {
2495 RefPat::cast(self.0.borrowed()).unwrap() 2698 RefPat::cast(self.0.borrowed()).unwrap()
2496 } 2699 }
2497} 2700}
2701
2702impl<'a> From<RefPat<'a>> for RefPatNode {
2703 fn from(ast: RefPat<'a>) -> RefPatNode {
2704 let syntax = ast.syntax().owned();
2705 RefPatNode(syntax)
2706 }
2707}
2498#[derive(Debug, Clone, Copy)] 2708#[derive(Debug, Clone, Copy)]
2499pub struct RefPat<'a> { 2709pub struct RefPat<'a> {
2500 syntax: SyntaxNodeRef<'a>, 2710 syntax: SyntaxNodeRef<'a>,
@@ -2518,14 +2728,17 @@ impl<'a> RefPat<'a> {}
2518pub struct ReferenceTypeNode(SyntaxNode); 2728pub struct ReferenceTypeNode(SyntaxNode);
2519 2729
2520impl ReferenceTypeNode { 2730impl ReferenceTypeNode {
2521 pub fn new(ast: ReferenceType) -> ReferenceTypeNode {
2522 let syntax = ast.syntax().owned();
2523 ReferenceTypeNode(syntax)
2524 }
2525 pub fn ast(&self) -> ReferenceType { 2731 pub fn ast(&self) -> ReferenceType {
2526 ReferenceType::cast(self.0.borrowed()).unwrap() 2732 ReferenceType::cast(self.0.borrowed()).unwrap()
2527 } 2733 }
2528} 2734}
2735
2736impl<'a> From<ReferenceType<'a>> for ReferenceTypeNode {
2737 fn from(ast: ReferenceType<'a>) -> ReferenceTypeNode {
2738 let syntax = ast.syntax().owned();
2739 ReferenceTypeNode(syntax)
2740 }
2741}
2529#[derive(Debug, Clone, Copy)] 2742#[derive(Debug, Clone, Copy)]
2530pub struct ReferenceType<'a> { 2743pub struct ReferenceType<'a> {
2531 syntax: SyntaxNodeRef<'a>, 2744 syntax: SyntaxNodeRef<'a>,
@@ -2549,14 +2762,17 @@ impl<'a> ReferenceType<'a> {}
2549pub struct RetTypeNode(SyntaxNode); 2762pub struct RetTypeNode(SyntaxNode);
2550 2763
2551impl RetTypeNode { 2764impl RetTypeNode {
2552 pub fn new(ast: RetType) -> RetTypeNode {
2553 let syntax = ast.syntax().owned();
2554 RetTypeNode(syntax)
2555 }
2556 pub fn ast(&self) -> RetType { 2765 pub fn ast(&self) -> RetType {
2557 RetType::cast(self.0.borrowed()).unwrap() 2766 RetType::cast(self.0.borrowed()).unwrap()
2558 } 2767 }
2559} 2768}
2769
2770impl<'a> From<RetType<'a>> for RetTypeNode {
2771 fn from(ast: RetType<'a>) -> RetTypeNode {
2772 let syntax = ast.syntax().owned();
2773 RetTypeNode(syntax)
2774 }
2775}
2560#[derive(Debug, Clone, Copy)] 2776#[derive(Debug, Clone, Copy)]
2561pub struct RetType<'a> { 2777pub struct RetType<'a> {
2562 syntax: SyntaxNodeRef<'a>, 2778 syntax: SyntaxNodeRef<'a>,
@@ -2580,14 +2796,17 @@ impl<'a> RetType<'a> {}
2580pub struct ReturnExprNode(SyntaxNode); 2796pub struct ReturnExprNode(SyntaxNode);
2581 2797
2582impl ReturnExprNode { 2798impl ReturnExprNode {
2583 pub fn new(ast: ReturnExpr) -> ReturnExprNode {
2584 let syntax = ast.syntax().owned();
2585 ReturnExprNode(syntax)
2586 }
2587 pub fn ast(&self) -> ReturnExpr { 2799 pub fn ast(&self) -> ReturnExpr {
2588 ReturnExpr::cast(self.0.borrowed()).unwrap() 2800 ReturnExpr::cast(self.0.borrowed()).unwrap()
2589 } 2801 }
2590} 2802}
2803
2804impl<'a> From<ReturnExpr<'a>> for ReturnExprNode {
2805 fn from(ast: ReturnExpr<'a>) -> ReturnExprNode {
2806 let syntax = ast.syntax().owned();
2807 ReturnExprNode(syntax)
2808 }
2809}
2591#[derive(Debug, Clone, Copy)] 2810#[derive(Debug, Clone, Copy)]
2592pub struct ReturnExpr<'a> { 2811pub struct ReturnExpr<'a> {
2593 syntax: SyntaxNodeRef<'a>, 2812 syntax: SyntaxNodeRef<'a>,
@@ -2611,14 +2830,17 @@ impl<'a> ReturnExpr<'a> {}
2611pub struct RootNode(SyntaxNode); 2830pub struct RootNode(SyntaxNode);
2612 2831
2613impl RootNode { 2832impl RootNode {
2614 pub fn new(ast: Root) -> RootNode {
2615 let syntax = ast.syntax().owned();
2616 RootNode(syntax)
2617 }
2618 pub fn ast(&self) -> Root { 2833 pub fn ast(&self) -> Root {
2619 Root::cast(self.0.borrowed()).unwrap() 2834 Root::cast(self.0.borrowed()).unwrap()
2620 } 2835 }
2621} 2836}
2837
2838impl<'a> From<Root<'a>> for RootNode {
2839 fn from(ast: Root<'a>) -> RootNode {
2840 let syntax = ast.syntax().owned();
2841 RootNode(syntax)
2842 }
2843}
2622#[derive(Debug, Clone, Copy)] 2844#[derive(Debug, Clone, Copy)]
2623pub struct Root<'a> { 2845pub struct Root<'a> {
2624 syntax: SyntaxNodeRef<'a>, 2846 syntax: SyntaxNodeRef<'a>,
@@ -2648,14 +2870,17 @@ impl<'a> Root<'a> {
2648pub struct SelfParamNode(SyntaxNode); 2870pub struct SelfParamNode(SyntaxNode);
2649 2871
2650impl SelfParamNode { 2872impl SelfParamNode {
2651 pub fn new(ast: SelfParam) -> SelfParamNode {
2652 let syntax = ast.syntax().owned();
2653 SelfParamNode(syntax)
2654 }
2655 pub fn ast(&self) -> SelfParam { 2873 pub fn ast(&self) -> SelfParam {
2656 SelfParam::cast(self.0.borrowed()).unwrap() 2874 SelfParam::cast(self.0.borrowed()).unwrap()
2657 } 2875 }
2658} 2876}
2877
2878impl<'a> From<SelfParam<'a>> for SelfParamNode {
2879 fn from(ast: SelfParam<'a>) -> SelfParamNode {
2880 let syntax = ast.syntax().owned();
2881 SelfParamNode(syntax)
2882 }
2883}
2659#[derive(Debug, Clone, Copy)] 2884#[derive(Debug, Clone, Copy)]
2660pub struct SelfParam<'a> { 2885pub struct SelfParam<'a> {
2661 syntax: SyntaxNodeRef<'a>, 2886 syntax: SyntaxNodeRef<'a>,
@@ -2679,14 +2904,17 @@ impl<'a> SelfParam<'a> {}
2679pub struct SlicePatNode(SyntaxNode); 2904pub struct SlicePatNode(SyntaxNode);
2680 2905
2681impl SlicePatNode { 2906impl SlicePatNode {
2682 pub fn new(ast: SlicePat) -> SlicePatNode {
2683 let syntax = ast.syntax().owned();
2684 SlicePatNode(syntax)
2685 }
2686 pub fn ast(&self) -> SlicePat { 2907 pub fn ast(&self) -> SlicePat {
2687 SlicePat::cast(self.0.borrowed()).unwrap() 2908 SlicePat::cast(self.0.borrowed()).unwrap()
2688 } 2909 }
2689} 2910}
2911
2912impl<'a> From<SlicePat<'a>> for SlicePatNode {
2913 fn from(ast: SlicePat<'a>) -> SlicePatNode {
2914 let syntax = ast.syntax().owned();
2915 SlicePatNode(syntax)
2916 }
2917}
2690#[derive(Debug, Clone, Copy)] 2918#[derive(Debug, Clone, Copy)]
2691pub struct SlicePat<'a> { 2919pub struct SlicePat<'a> {
2692 syntax: SyntaxNodeRef<'a>, 2920 syntax: SyntaxNodeRef<'a>,
@@ -2710,14 +2938,17 @@ impl<'a> SlicePat<'a> {}
2710pub struct SliceTypeNode(SyntaxNode); 2938pub struct SliceTypeNode(SyntaxNode);
2711 2939
2712impl SliceTypeNode { 2940impl SliceTypeNode {
2713 pub fn new(ast: SliceType) -> SliceTypeNode {
2714 let syntax = ast.syntax().owned();
2715 SliceTypeNode(syntax)
2716 }
2717 pub fn ast(&self) -> SliceType { 2941 pub fn ast(&self) -> SliceType {
2718 SliceType::cast(self.0.borrowed()).unwrap() 2942 SliceType::cast(self.0.borrowed()).unwrap()
2719 } 2943 }
2720} 2944}
2945
2946impl<'a> From<SliceType<'a>> for SliceTypeNode {
2947 fn from(ast: SliceType<'a>) -> SliceTypeNode {
2948 let syntax = ast.syntax().owned();
2949 SliceTypeNode(syntax)
2950 }
2951}
2721#[derive(Debug, Clone, Copy)] 2952#[derive(Debug, Clone, Copy)]
2722pub struct SliceType<'a> { 2953pub struct SliceType<'a> {
2723 syntax: SyntaxNodeRef<'a>, 2954 syntax: SyntaxNodeRef<'a>,
@@ -2741,14 +2972,17 @@ impl<'a> SliceType<'a> {}
2741pub struct StaticDefNode(SyntaxNode); 2972pub struct StaticDefNode(SyntaxNode);
2742 2973
2743impl StaticDefNode { 2974impl StaticDefNode {
2744 pub fn new(ast: StaticDef) -> StaticDefNode {
2745 let syntax = ast.syntax().owned();
2746 StaticDefNode(syntax)
2747 }
2748 pub fn ast(&self) -> StaticDef { 2975 pub fn ast(&self) -> StaticDef {
2749 StaticDef::cast(self.0.borrowed()).unwrap() 2976 StaticDef::cast(self.0.borrowed()).unwrap()
2750 } 2977 }
2751} 2978}
2979
2980impl<'a> From<StaticDef<'a>> for StaticDefNode {
2981 fn from(ast: StaticDef<'a>) -> StaticDefNode {
2982 let syntax = ast.syntax().owned();
2983 StaticDefNode(syntax)
2984 }
2985}
2752#[derive(Debug, Clone, Copy)] 2986#[derive(Debug, Clone, Copy)]
2753pub struct StaticDef<'a> { 2987pub struct StaticDef<'a> {
2754 syntax: SyntaxNodeRef<'a>, 2988 syntax: SyntaxNodeRef<'a>,
@@ -2775,14 +3009,17 @@ impl<'a> StaticDef<'a> {}
2775pub struct StmtNode(SyntaxNode); 3009pub struct StmtNode(SyntaxNode);
2776 3010
2777impl StmtNode { 3011impl StmtNode {
2778 pub fn new(ast: Stmt) -> StmtNode {
2779 let syntax = ast.syntax().owned();
2780 StmtNode(syntax)
2781 }
2782 pub fn ast(&self) -> Stmt { 3012 pub fn ast(&self) -> Stmt {
2783 Stmt::cast(self.0.borrowed()).unwrap() 3013 Stmt::cast(self.0.borrowed()).unwrap()
2784 } 3014 }
2785} 3015}
3016
3017impl<'a> From<Stmt<'a>> for StmtNode {
3018 fn from(ast: Stmt<'a>) -> StmtNode {
3019 let syntax = ast.syntax().owned();
3020 StmtNode(syntax)
3021 }
3022}
2786#[derive(Debug, Clone, Copy)] 3023#[derive(Debug, Clone, Copy)]
2787pub enum Stmt<'a> { 3024pub enum Stmt<'a> {
2788 ExprStmt(ExprStmt<'a>), 3025 ExprStmt(ExprStmt<'a>),
@@ -2813,14 +3050,17 @@ impl<'a> Stmt<'a> {}
2813pub struct StructDefNode(SyntaxNode); 3050pub struct StructDefNode(SyntaxNode);
2814 3051
2815impl StructDefNode { 3052impl StructDefNode {
2816 pub fn new(ast: StructDef) -> StructDefNode {
2817 let syntax = ast.syntax().owned();
2818 StructDefNode(syntax)
2819 }
2820 pub fn ast(&self) -> StructDef { 3053 pub fn ast(&self) -> StructDef {
2821 StructDef::cast(self.0.borrowed()).unwrap() 3054 StructDef::cast(self.0.borrowed()).unwrap()
2822 } 3055 }
2823} 3056}
3057
3058impl<'a> From<StructDef<'a>> for StructDefNode {
3059 fn from(ast: StructDef<'a>) -> StructDefNode {
3060 let syntax = ast.syntax().owned();
3061 StructDefNode(syntax)
3062 }
3063}
2824#[derive(Debug, Clone, Copy)] 3064#[derive(Debug, Clone, Copy)]
2825pub struct StructDef<'a> { 3065pub struct StructDef<'a> {
2826 syntax: SyntaxNodeRef<'a>, 3066 syntax: SyntaxNodeRef<'a>,
@@ -2851,14 +3091,17 @@ impl<'a> StructDef<'a> {
2851pub struct StructLitNode(SyntaxNode); 3091pub struct StructLitNode(SyntaxNode);
2852 3092
2853impl StructLitNode { 3093impl StructLitNode {
2854 pub fn new(ast: StructLit) -> StructLitNode {
2855 let syntax = ast.syntax().owned();
2856 StructLitNode(syntax)
2857 }
2858 pub fn ast(&self) -> StructLit { 3094 pub fn ast(&self) -> StructLit {
2859 StructLit::cast(self.0.borrowed()).unwrap() 3095 StructLit::cast(self.0.borrowed()).unwrap()
2860 } 3096 }
2861} 3097}
3098
3099impl<'a> From<StructLit<'a>> for StructLitNode {
3100 fn from(ast: StructLit<'a>) -> StructLitNode {
3101 let syntax = ast.syntax().owned();
3102 StructLitNode(syntax)
3103 }
3104}
2862#[derive(Debug, Clone, Copy)] 3105#[derive(Debug, Clone, Copy)]
2863pub struct StructLit<'a> { 3106pub struct StructLit<'a> {
2864 syntax: SyntaxNodeRef<'a>, 3107 syntax: SyntaxNodeRef<'a>,
@@ -2882,14 +3125,17 @@ impl<'a> StructLit<'a> {}
2882pub struct StructPatNode(SyntaxNode); 3125pub struct StructPatNode(SyntaxNode);
2883 3126
2884impl StructPatNode { 3127impl StructPatNode {
2885 pub fn new(ast: StructPat) -> StructPatNode {
2886 let syntax = ast.syntax().owned();
2887 StructPatNode(syntax)
2888 }
2889 pub fn ast(&self) -> StructPat { 3128 pub fn ast(&self) -> StructPat {
2890 StructPat::cast(self.0.borrowed()).unwrap() 3129 StructPat::cast(self.0.borrowed()).unwrap()
2891 } 3130 }
2892} 3131}
3132
3133impl<'a> From<StructPat<'a>> for StructPatNode {
3134 fn from(ast: StructPat<'a>) -> StructPatNode {
3135 let syntax = ast.syntax().owned();
3136 StructPatNode(syntax)
3137 }
3138}
2893#[derive(Debug, Clone, Copy)] 3139#[derive(Debug, Clone, Copy)]
2894pub struct StructPat<'a> { 3140pub struct StructPat<'a> {
2895 syntax: SyntaxNodeRef<'a>, 3141 syntax: SyntaxNodeRef<'a>,
@@ -2913,14 +3159,17 @@ impl<'a> StructPat<'a> {}
2913pub struct TokenTreeNode(SyntaxNode); 3159pub struct TokenTreeNode(SyntaxNode);
2914 3160
2915impl TokenTreeNode { 3161impl TokenTreeNode {
2916 pub fn new(ast: TokenTree) -> TokenTreeNode {
2917 let syntax = ast.syntax().owned();
2918 TokenTreeNode(syntax)
2919 }
2920 pub fn ast(&self) -> TokenTree { 3162 pub fn ast(&self) -> TokenTree {
2921 TokenTree::cast(self.0.borrowed()).unwrap() 3163 TokenTree::cast(self.0.borrowed()).unwrap()
2922 } 3164 }
2923} 3165}
3166
3167impl<'a> From<TokenTree<'a>> for TokenTreeNode {
3168 fn from(ast: TokenTree<'a>) -> TokenTreeNode {
3169 let syntax = ast.syntax().owned();
3170 TokenTreeNode(syntax)
3171 }
3172}
2924#[derive(Debug, Clone, Copy)] 3173#[derive(Debug, Clone, Copy)]
2925pub struct TokenTree<'a> { 3174pub struct TokenTree<'a> {
2926 syntax: SyntaxNodeRef<'a>, 3175 syntax: SyntaxNodeRef<'a>,
@@ -2944,14 +3193,17 @@ impl<'a> TokenTree<'a> {}
2944pub struct TraitDefNode(SyntaxNode); 3193pub struct TraitDefNode(SyntaxNode);
2945 3194
2946impl TraitDefNode { 3195impl TraitDefNode {
2947 pub fn new(ast: TraitDef) -> TraitDefNode {
2948 let syntax = ast.syntax().owned();
2949 TraitDefNode(syntax)
2950 }
2951 pub fn ast(&self) -> TraitDef { 3196 pub fn ast(&self) -> TraitDef {
2952 TraitDef::cast(self.0.borrowed()).unwrap() 3197 TraitDef::cast(self.0.borrowed()).unwrap()
2953 } 3198 }
2954} 3199}
3200
3201impl<'a> From<TraitDef<'a>> for TraitDefNode {
3202 fn from(ast: TraitDef<'a>) -> TraitDefNode {
3203 let syntax = ast.syntax().owned();
3204 TraitDefNode(syntax)
3205 }
3206}
2955#[derive(Debug, Clone, Copy)] 3207#[derive(Debug, Clone, Copy)]
2956pub struct TraitDef<'a> { 3208pub struct TraitDef<'a> {
2957 syntax: SyntaxNodeRef<'a>, 3209 syntax: SyntaxNodeRef<'a>,
@@ -2977,14 +3229,17 @@ impl<'a> TraitDef<'a> {}
2977pub struct TryExprNode(SyntaxNode); 3229pub struct TryExprNode(SyntaxNode);
2978 3230
2979impl TryExprNode { 3231impl TryExprNode {
2980 pub fn new(ast: TryExpr) -> TryExprNode {
2981 let syntax = ast.syntax().owned();
2982 TryExprNode(syntax)
2983 }
2984 pub fn ast(&self) -> TryExpr { 3232 pub fn ast(&self) -> TryExpr {
2985 TryExpr::cast(self.0.borrowed()).unwrap() 3233 TryExpr::cast(self.0.borrowed()).unwrap()
2986 } 3234 }
2987} 3235}
3236
3237impl<'a> From<TryExpr<'a>> for TryExprNode {
3238 fn from(ast: TryExpr<'a>) -> TryExprNode {
3239 let syntax = ast.syntax().owned();
3240 TryExprNode(syntax)
3241 }
3242}
2988#[derive(Debug, Clone, Copy)] 3243#[derive(Debug, Clone, Copy)]
2989pub struct TryExpr<'a> { 3244pub struct TryExpr<'a> {
2990 syntax: SyntaxNodeRef<'a>, 3245 syntax: SyntaxNodeRef<'a>,
@@ -3008,14 +3263,17 @@ impl<'a> TryExpr<'a> {}
3008pub struct TupleExprNode(SyntaxNode); 3263pub struct TupleExprNode(SyntaxNode);
3009 3264
3010impl TupleExprNode { 3265impl TupleExprNode {
3011 pub fn new(ast: TupleExpr) -> TupleExprNode {
3012 let syntax = ast.syntax().owned();
3013 TupleExprNode(syntax)
3014 }
3015 pub fn ast(&self) -> TupleExpr { 3266 pub fn ast(&self) -> TupleExpr {
3016 TupleExpr::cast(self.0.borrowed()).unwrap() 3267 TupleExpr::cast(self.0.borrowed()).unwrap()
3017 } 3268 }
3018} 3269}
3270
3271impl<'a> From<TupleExpr<'a>> for TupleExprNode {
3272 fn from(ast: TupleExpr<'a>) -> TupleExprNode {
3273 let syntax = ast.syntax().owned();
3274 TupleExprNode(syntax)
3275 }
3276}
3019#[derive(Debug, Clone, Copy)] 3277#[derive(Debug, Clone, Copy)]
3020pub struct TupleExpr<'a> { 3278pub struct TupleExpr<'a> {
3021 syntax: SyntaxNodeRef<'a>, 3279 syntax: SyntaxNodeRef<'a>,
@@ -3039,14 +3297,17 @@ impl<'a> TupleExpr<'a> {}
3039pub struct TuplePatNode(SyntaxNode); 3297pub struct TuplePatNode(SyntaxNode);
3040 3298
3041impl TuplePatNode { 3299impl TuplePatNode {
3042 pub fn new(ast: TuplePat) -> TuplePatNode {
3043 let syntax = ast.syntax().owned();
3044 TuplePatNode(syntax)
3045 }
3046 pub fn ast(&self) -> TuplePat { 3300 pub fn ast(&self) -> TuplePat {
3047 TuplePat::cast(self.0.borrowed()).unwrap() 3301 TuplePat::cast(self.0.borrowed()).unwrap()
3048 } 3302 }
3049} 3303}
3304
3305impl<'a> From<TuplePat<'a>> for TuplePatNode {
3306 fn from(ast: TuplePat<'a>) -> TuplePatNode {
3307 let syntax = ast.syntax().owned();
3308 TuplePatNode(syntax)
3309 }
3310}
3050#[derive(Debug, Clone, Copy)] 3311#[derive(Debug, Clone, Copy)]
3051pub struct TuplePat<'a> { 3312pub struct TuplePat<'a> {
3052 syntax: SyntaxNodeRef<'a>, 3313 syntax: SyntaxNodeRef<'a>,
@@ -3070,14 +3331,17 @@ impl<'a> TuplePat<'a> {}
3070pub struct TupleStructPatNode(SyntaxNode); 3331pub struct TupleStructPatNode(SyntaxNode);
3071 3332
3072impl TupleStructPatNode { 3333impl TupleStructPatNode {
3073 pub fn new(ast: TupleStructPat) -> TupleStructPatNode {
3074 let syntax = ast.syntax().owned();
3075 TupleStructPatNode(syntax)
3076 }
3077 pub fn ast(&self) -> TupleStructPat { 3334 pub fn ast(&self) -> TupleStructPat {
3078 TupleStructPat::cast(self.0.borrowed()).unwrap() 3335 TupleStructPat::cast(self.0.borrowed()).unwrap()
3079 } 3336 }
3080} 3337}
3338
3339impl<'a> From<TupleStructPat<'a>> for TupleStructPatNode {
3340 fn from(ast: TupleStructPat<'a>) -> TupleStructPatNode {
3341 let syntax = ast.syntax().owned();
3342 TupleStructPatNode(syntax)
3343 }
3344}
3081#[derive(Debug, Clone, Copy)] 3345#[derive(Debug, Clone, Copy)]
3082pub struct TupleStructPat<'a> { 3346pub struct TupleStructPat<'a> {
3083 syntax: SyntaxNodeRef<'a>, 3347 syntax: SyntaxNodeRef<'a>,
@@ -3101,14 +3365,17 @@ impl<'a> TupleStructPat<'a> {}
3101pub struct TupleTypeNode(SyntaxNode); 3365pub struct TupleTypeNode(SyntaxNode);
3102 3366
3103impl TupleTypeNode { 3367impl TupleTypeNode {
3104 pub fn new(ast: TupleType) -> TupleTypeNode {
3105 let syntax = ast.syntax().owned();
3106 TupleTypeNode(syntax)
3107 }
3108 pub fn ast(&self) -> TupleType { 3368 pub fn ast(&self) -> TupleType {
3109 TupleType::cast(self.0.borrowed()).unwrap() 3369 TupleType::cast(self.0.borrowed()).unwrap()
3110 } 3370 }
3111} 3371}
3372
3373impl<'a> From<TupleType<'a>> for TupleTypeNode {
3374 fn from(ast: TupleType<'a>) -> TupleTypeNode {
3375 let syntax = ast.syntax().owned();
3376 TupleTypeNode(syntax)
3377 }
3378}
3112#[derive(Debug, Clone, Copy)] 3379#[derive(Debug, Clone, Copy)]
3113pub struct TupleType<'a> { 3380pub struct TupleType<'a> {
3114 syntax: SyntaxNodeRef<'a>, 3381 syntax: SyntaxNodeRef<'a>,
@@ -3132,14 +3399,17 @@ impl<'a> TupleType<'a> {}
3132pub struct TypeDefNode(SyntaxNode); 3399pub struct TypeDefNode(SyntaxNode);
3133 3400
3134impl TypeDefNode { 3401impl TypeDefNode {
3135 pub fn new(ast: TypeDef) -> TypeDefNode {
3136 let syntax = ast.syntax().owned();
3137 TypeDefNode(syntax)
3138 }
3139 pub fn ast(&self) -> TypeDef { 3402 pub fn ast(&self) -> TypeDef {
3140 TypeDef::cast(self.0.borrowed()).unwrap() 3403 TypeDef::cast(self.0.borrowed()).unwrap()
3141 } 3404 }
3142} 3405}
3406
3407impl<'a> From<TypeDef<'a>> for TypeDefNode {
3408 fn from(ast: TypeDef<'a>) -> TypeDefNode {
3409 let syntax = ast.syntax().owned();
3410 TypeDefNode(syntax)
3411 }
3412}
3143#[derive(Debug, Clone, Copy)] 3413#[derive(Debug, Clone, Copy)]
3144pub struct TypeDef<'a> { 3414pub struct TypeDef<'a> {
3145 syntax: SyntaxNodeRef<'a>, 3415 syntax: SyntaxNodeRef<'a>,
@@ -3166,14 +3436,17 @@ impl<'a> TypeDef<'a> {}
3166pub struct TypeParamNode(SyntaxNode); 3436pub struct TypeParamNode(SyntaxNode);
3167 3437
3168impl TypeParamNode { 3438impl TypeParamNode {
3169 pub fn new(ast: TypeParam) -> TypeParamNode {
3170 let syntax = ast.syntax().owned();
3171 TypeParamNode(syntax)
3172 }
3173 pub fn ast(&self) -> TypeParam { 3439 pub fn ast(&self) -> TypeParam {
3174 TypeParam::cast(self.0.borrowed()).unwrap() 3440 TypeParam::cast(self.0.borrowed()).unwrap()
3175 } 3441 }
3176} 3442}
3443
3444impl<'a> From<TypeParam<'a>> for TypeParamNode {
3445 fn from(ast: TypeParam<'a>) -> TypeParamNode {
3446 let syntax = ast.syntax().owned();
3447 TypeParamNode(syntax)
3448 }
3449}
3177#[derive(Debug, Clone, Copy)] 3450#[derive(Debug, Clone, Copy)]
3178pub struct TypeParam<'a> { 3451pub struct TypeParam<'a> {
3179 syntax: SyntaxNodeRef<'a>, 3452 syntax: SyntaxNodeRef<'a>,
@@ -3198,14 +3471,17 @@ impl<'a> TypeParam<'a> {}
3198pub struct TypeParamListNode(SyntaxNode); 3471pub struct TypeParamListNode(SyntaxNode);
3199 3472
3200impl TypeParamListNode { 3473impl TypeParamListNode {
3201 pub fn new(ast: TypeParamList) -> TypeParamListNode {
3202 let syntax = ast.syntax().owned();
3203 TypeParamListNode(syntax)
3204 }
3205 pub fn ast(&self) -> TypeParamList { 3474 pub fn ast(&self) -> TypeParamList {
3206 TypeParamList::cast(self.0.borrowed()).unwrap() 3475 TypeParamList::cast(self.0.borrowed()).unwrap()
3207 } 3476 }
3208} 3477}
3478
3479impl<'a> From<TypeParamList<'a>> for TypeParamListNode {
3480 fn from(ast: TypeParamList<'a>) -> TypeParamListNode {
3481 let syntax = ast.syntax().owned();
3482 TypeParamListNode(syntax)
3483 }
3484}
3209#[derive(Debug, Clone, Copy)] 3485#[derive(Debug, Clone, Copy)]
3210pub struct TypeParamList<'a> { 3486pub struct TypeParamList<'a> {
3211 syntax: SyntaxNodeRef<'a>, 3487 syntax: SyntaxNodeRef<'a>,
@@ -3237,14 +3513,17 @@ impl<'a> TypeParamList<'a> {
3237pub struct TypeRefNode(SyntaxNode); 3513pub struct TypeRefNode(SyntaxNode);
3238 3514
3239impl TypeRefNode { 3515impl TypeRefNode {
3240 pub fn new(ast: TypeRef) -> TypeRefNode {
3241 let syntax = ast.syntax().owned();
3242 TypeRefNode(syntax)
3243 }
3244 pub fn ast(&self) -> TypeRef { 3516 pub fn ast(&self) -> TypeRef {
3245 TypeRef::cast(self.0.borrowed()).unwrap() 3517 TypeRef::cast(self.0.borrowed()).unwrap()
3246 } 3518 }
3247} 3519}
3520
3521impl<'a> From<TypeRef<'a>> for TypeRefNode {
3522 fn from(ast: TypeRef<'a>) -> TypeRefNode {
3523 let syntax = ast.syntax().owned();
3524 TypeRefNode(syntax)
3525 }
3526}
3248#[derive(Debug, Clone, Copy)] 3527#[derive(Debug, Clone, Copy)]
3249pub enum TypeRef<'a> { 3528pub enum TypeRef<'a> {
3250 ParenType(ParenType<'a>), 3529 ParenType(ParenType<'a>),
@@ -3308,14 +3587,17 @@ impl<'a> TypeRef<'a> {}
3308pub struct UseItemNode(SyntaxNode); 3587pub struct UseItemNode(SyntaxNode);
3309 3588
3310impl UseItemNode { 3589impl UseItemNode {
3311 pub fn new(ast: UseItem) -> UseItemNode {
3312 let syntax = ast.syntax().owned();
3313 UseItemNode(syntax)
3314 }
3315 pub fn ast(&self) -> UseItem { 3590 pub fn ast(&self) -> UseItem {
3316 UseItem::cast(self.0.borrowed()).unwrap() 3591 UseItem::cast(self.0.borrowed()).unwrap()
3317 } 3592 }
3318} 3593}
3594
3595impl<'a> From<UseItem<'a>> for UseItemNode {
3596 fn from(ast: UseItem<'a>) -> UseItemNode {
3597 let syntax = ast.syntax().owned();
3598 UseItemNode(syntax)
3599 }
3600}
3319#[derive(Debug, Clone, Copy)] 3601#[derive(Debug, Clone, Copy)]
3320pub struct UseItem<'a> { 3602pub struct UseItem<'a> {
3321 syntax: SyntaxNodeRef<'a>, 3603 syntax: SyntaxNodeRef<'a>,
@@ -3343,14 +3625,17 @@ impl<'a> UseItem<'a> {
3343pub struct UseTreeNode(SyntaxNode); 3625pub struct UseTreeNode(SyntaxNode);
3344 3626
3345impl UseTreeNode { 3627impl UseTreeNode {
3346 pub fn new(ast: UseTree) -> UseTreeNode {
3347 let syntax = ast.syntax().owned();
3348 UseTreeNode(syntax)
3349 }
3350 pub fn ast(&self) -> UseTree { 3628 pub fn ast(&self) -> UseTree {
3351 UseTree::cast(self.0.borrowed()).unwrap() 3629 UseTree::cast(self.0.borrowed()).unwrap()
3352 } 3630 }
3353} 3631}
3632
3633impl<'a> From<UseTree<'a>> for UseTreeNode {
3634 fn from(ast: UseTree<'a>) -> UseTreeNode {
3635 let syntax = ast.syntax().owned();
3636 UseTreeNode(syntax)
3637 }
3638}
3354#[derive(Debug, Clone, Copy)] 3639#[derive(Debug, Clone, Copy)]
3355pub struct UseTree<'a> { 3640pub struct UseTree<'a> {
3356 syntax: SyntaxNodeRef<'a>, 3641 syntax: SyntaxNodeRef<'a>,
@@ -3382,14 +3667,17 @@ impl<'a> UseTree<'a> {
3382pub struct UseTreeListNode(SyntaxNode); 3667pub struct UseTreeListNode(SyntaxNode);
3383 3668
3384impl UseTreeListNode { 3669impl UseTreeListNode {
3385 pub fn new(ast: UseTreeList) -> UseTreeListNode {
3386 let syntax = ast.syntax().owned();
3387 UseTreeListNode(syntax)
3388 }
3389 pub fn ast(&self) -> UseTreeList { 3670 pub fn ast(&self) -> UseTreeList {
3390 UseTreeList::cast(self.0.borrowed()).unwrap() 3671 UseTreeList::cast(self.0.borrowed()).unwrap()
3391 } 3672 }
3392} 3673}
3674
3675impl<'a> From<UseTreeList<'a>> for UseTreeListNode {
3676 fn from(ast: UseTreeList<'a>) -> UseTreeListNode {
3677 let syntax = ast.syntax().owned();
3678 UseTreeListNode(syntax)
3679 }
3680}
3393#[derive(Debug, Clone, Copy)] 3681#[derive(Debug, Clone, Copy)]
3394pub struct UseTreeList<'a> { 3682pub struct UseTreeList<'a> {
3395 syntax: SyntaxNodeRef<'a>, 3683 syntax: SyntaxNodeRef<'a>,
@@ -3417,14 +3705,17 @@ impl<'a> UseTreeList<'a> {
3417pub struct WhereClauseNode(SyntaxNode); 3705pub struct WhereClauseNode(SyntaxNode);
3418 3706
3419impl WhereClauseNode { 3707impl WhereClauseNode {
3420 pub fn new(ast: WhereClause) -> WhereClauseNode {
3421 let syntax = ast.syntax().owned();
3422 WhereClauseNode(syntax)
3423 }
3424 pub fn ast(&self) -> WhereClause { 3708 pub fn ast(&self) -> WhereClause {
3425 WhereClause::cast(self.0.borrowed()).unwrap() 3709 WhereClause::cast(self.0.borrowed()).unwrap()
3426 } 3710 }
3427} 3711}
3712
3713impl<'a> From<WhereClause<'a>> for WhereClauseNode {
3714 fn from(ast: WhereClause<'a>) -> WhereClauseNode {
3715 let syntax = ast.syntax().owned();
3716 WhereClauseNode(syntax)
3717 }
3718}
3428#[derive(Debug, Clone, Copy)] 3719#[derive(Debug, Clone, Copy)]
3429pub struct WhereClause<'a> { 3720pub struct WhereClause<'a> {
3430 syntax: SyntaxNodeRef<'a>, 3721 syntax: SyntaxNodeRef<'a>,
@@ -3448,14 +3739,17 @@ impl<'a> WhereClause<'a> {}
3448pub struct WhileExprNode(SyntaxNode); 3739pub struct WhileExprNode(SyntaxNode);
3449 3740
3450impl WhileExprNode { 3741impl WhileExprNode {
3451 pub fn new(ast: WhileExpr) -> WhileExprNode {
3452 let syntax = ast.syntax().owned();
3453 WhileExprNode(syntax)
3454 }
3455 pub fn ast(&self) -> WhileExpr { 3742 pub fn ast(&self) -> WhileExpr {
3456 WhileExpr::cast(self.0.borrowed()).unwrap() 3743 WhileExpr::cast(self.0.borrowed()).unwrap()
3457 } 3744 }
3458} 3745}
3746
3747impl<'a> From<WhileExpr<'a>> for WhileExprNode {
3748 fn from(ast: WhileExpr<'a>) -> WhileExprNode {
3749 let syntax = ast.syntax().owned();
3750 WhileExprNode(syntax)
3751 }
3752}
3459#[derive(Debug, Clone, Copy)] 3753#[derive(Debug, Clone, Copy)]
3460pub struct WhileExpr<'a> { 3754pub struct WhileExpr<'a> {
3461 syntax: SyntaxNodeRef<'a>, 3755 syntax: SyntaxNodeRef<'a>,
@@ -3484,14 +3778,17 @@ impl<'a> WhileExpr<'a> {
3484pub struct WhitespaceNode(SyntaxNode); 3778pub struct WhitespaceNode(SyntaxNode);
3485 3779
3486impl WhitespaceNode { 3780impl WhitespaceNode {
3487 pub fn new(ast: Whitespace) -> WhitespaceNode {
3488 let syntax = ast.syntax().owned();
3489 WhitespaceNode(syntax)
3490 }
3491 pub fn ast(&self) -> Whitespace { 3781 pub fn ast(&self) -> Whitespace {
3492 Whitespace::cast(self.0.borrowed()).unwrap() 3782 Whitespace::cast(self.0.borrowed()).unwrap()
3493 } 3783 }
3494} 3784}
3785
3786impl<'a> From<Whitespace<'a>> for WhitespaceNode {
3787 fn from(ast: Whitespace<'a>) -> WhitespaceNode {
3788 let syntax = ast.syntax().owned();
3789 WhitespaceNode(syntax)
3790 }
3791}
3495#[derive(Debug, Clone, Copy)] 3792#[derive(Debug, Clone, Copy)]
3496pub struct Whitespace<'a> { 3793pub struct Whitespace<'a> {
3497 syntax: SyntaxNodeRef<'a>, 3794 syntax: SyntaxNodeRef<'a>,
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index d30038cba..1321f0def 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -17,15 +17,18 @@ use crate::{
17pub struct {{ node }}Node(SyntaxNode); 17pub struct {{ node }}Node(SyntaxNode);
18 18
19impl {{ node }}Node { 19impl {{ node }}Node {
20 pub fn new(ast: {{ node }}) -> {{ node }}Node {
21 let syntax = ast.syntax().owned();
22 {{ node }}Node(syntax)
23 }
24 pub fn ast(&self) -> {{ node }} { 20 pub fn ast(&self) -> {{ node }} {
25 {{ node }}::cast(self.0.borrowed()).unwrap() 21 {{ node }}::cast(self.0.borrowed()).unwrap()
26 } 22 }
27} 23}
28 24
25impl<'a> From<{{ node }}<'a>> for {{ node }}Node {
26 fn from(ast: {{ node}}<'a>) -> {{ node }}Node {
27 let syntax = ast.syntax().owned();
28 {{ node }}Node(syntax)
29 }
30}
31
29{%- if methods.enum %} 32{%- if methods.enum %}
30#[derive(Debug, Clone, Copy)] 33#[derive(Debug, Clone, Copy)]
31pub enum {{ node }}<'a> { 34pub enum {{ node }}<'a> {