pub trait Node: Any {
// Required methods
fn initial_position(&self) -> usize;
fn final_position(&self) -> usize;
fn children(&self) -> Vec<&dyn Node>;
fn get_description(&self) -> String;
// Provided method
fn comments(&self) -> Option<&CommentGroup> { ... }
}
Required Methodsยง
Sourcefn initial_position(&self) -> usize
fn initial_position(&self) -> usize
The position of the first token in the node.
Sourcefn final_position(&self) -> usize
fn final_position(&self) -> usize
The position of the last token in the node, including the last token itself.
This is not necessarily the same as the last token in the nodeโs children.
Sourcefn children(&self) -> Vec<&dyn Node>
fn children(&self) -> Vec<&dyn Node>
The children of the node.
This is used for traversing the tree.
Sourcefn get_description(&self) -> String
fn get_description(&self) -> String
The description of the node.
Provided Methodsยง
Sourcefn comments(&self) -> Option<&CommentGroup>
fn comments(&self) -> Option<&CommentGroup>
The comments associated with the node.