diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/mod.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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. | ||
15 | pub trait AstNode<'a>: Clone + Copy + 'a { | 19 | pub 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 |