Add a pinch of comments

This commit is contained in:
Aleksey Kladov
2018-11-06 22:06:58 +03:00
parent a5301e94d5
commit 7f88fe8790
3 changed files with 16 additions and 0 deletions

View File

@@ -12,6 +12,10 @@ use crate::{
SyntaxNodeRef,
};
/// The main trait to go from untyped `SyntaxNode` to a typed ast. The
/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
/// the same representation: a pointer to the tree root and a pointer to the
/// node itself.
pub trait AstNode<'a>: Clone + Copy + 'a {
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
where