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.rs6
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera6
-rw-r--r--crates/ra_syntax/src/ast/mod.rs4
3 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index d473478a9..420d9090c 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1,6 +1,12 @@
1// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run 1// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
2// Do not edit manually 2// Do not edit manually
3 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
4#![cfg_attr(rustfmt, rustfmt_skip)] 10#![cfg_attr(rustfmt, rustfmt_skip)]
5 11
6use crate::{ 12use crate::{
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index 6e28575b2..d4fc6b5bd 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -3,6 +3,12 @@ the below applies to the result of this template
3#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run 3#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
4// Do not edit manually 4// Do not edit manually
5 5
6//! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
7//! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
8//! are Arc-based. You can switch between the two variants using `.owned` and
9//! `.borrowed` functions. Most of the code works with borowed mode, and only
10//! this mode has all AST accessors.
11
6#![cfg_attr(rustfmt, rustfmt_skip)] 12#![cfg_attr(rustfmt, rustfmt_skip)]
7 13
8use crate::{ 14use crate::{
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs
index 4355531d0..d93f92672 100644
--- a/crates/ra_syntax/src/ast/mod.rs
+++ b/crates/ra_syntax/src/ast/mod.rs
@@ -12,6 +12,10 @@ use crate::{
12 SyntaxNodeRef, 12 SyntaxNodeRef,
13}; 13};
14 14
15/// The main trait to go from untyped `SyntaxNode` to a typed ast. The
16/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
17/// the same representation: a pointer to the tree root and a pointer to the
18/// node itself.
15pub trait AstNode<'a>: Clone + Copy + 'a { 19pub trait AstNode<'a>: Clone + Copy + 'a {
16 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> 20 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
17 where 21 where