aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs.tera
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs.tera')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index e1404deac..c61c3e80b 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -7,11 +7,25 @@ the below applies to the result of this template
7 7
8use crate::{ 8use crate::{
9 ast, 9 ast,
10 SyntaxNodeRef, AstNode, 10 SyntaxNode, SyntaxNodeRef, AstNode,
11 SyntaxKind::*, 11 SyntaxKind::*,
12}; 12};
13{% for node, methods in ast %} 13{% for node, methods in ast %}
14// {{ node }} 14// {{ node }}
15
16#[derive(Debug, Clone)]
17pub struct {{ node }}Node(SyntaxNode);
18
19impl {{ node }}Node {
20 pub fn new(&self, ast: {{ node }}) -> {{ node }}Node {
21 let syntax = ast.syntax().owned();
22 {{ node }}Node(syntax)
23 }
24 pub fn ast(&self) -> {{ node }} {
25 {{ node }}::cast(self.0.borrowed()).unwrap()
26 }
27}
28
15{%- if methods.enum %} 29{%- if methods.enum %}
16#[derive(Debug, Clone, Copy)] 30#[derive(Debug, Clone, Copy)]
17pub enum {{ node }}<'a> { 31pub enum {{ node }}<'a> {