File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
2
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
10
#![ cfg_attr( rustfmt, rustfmt_skip) ]
5
11
6
12
use crate :: {
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ the below applies to the result of this template
3
3
#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
4
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
12
#![cfg_attr(rustfmt, rustfmt_skip)]
7
13
8
14
use crate::{
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ use crate::{
12
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.
15
19
pub trait AstNode < ' a > : Clone + Copy + ' a {
16
20
fn cast ( syntax : SyntaxNodeRef < ' a > ) -> Option < Self >
17
21
where
You can’t perform that action at this time.
0 commit comments