mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Add a pinch of comments
This commit is contained in:
parent
a5301e94d5
commit
7f88fe8790
3 changed files with 16 additions and 0 deletions
|
@ -1,6 +1,12 @@
|
||||||
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
|
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
|
||||||
// Do not edit manually
|
// Do not edit manually
|
||||||
|
|
||||||
|
//! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
|
||||||
|
//! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
|
||||||
|
//! are Arc-based. You can switch between the two variants using `.owned` and
|
||||||
|
//! `.borrowed` functions. Most of the code works with borowed mode, and only
|
||||||
|
//! this mode has all AST accessors.
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -3,6 +3,12 @@ the below applies to the result of this template
|
||||||
#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
|
#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
|
||||||
// Do not edit manually
|
// Do not edit manually
|
||||||
|
|
||||||
|
//! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
|
||||||
|
//! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
|
||||||
|
//! are Arc-based. You can switch between the two variants using `.owned` and
|
||||||
|
//! `.borrowed` functions. Most of the code works with borowed mode, and only
|
||||||
|
//! this mode has all AST accessors.
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -12,6 +12,10 @@ use crate::{
|
||||||
SyntaxNodeRef,
|
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 {
|
pub trait AstNode<'a>: Clone + Copy + 'a {
|
||||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
|
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue