Trait full_moon::node::Node [−][src]
pub trait Node<'ast>: Sealed { fn start_position(&self) -> Option<Position>; fn end_position(&self) -> Option<Position>; fn similar(&self, other: &Self) -> bool
where
Self: Sized; fn tokens<'b>(&'b self) -> Tokens<'ast, 'b>ⓘ; fn range(&self) -> Option<(Position, Position)> { ... } fn surrounding_trivia<'b>(Notable traits for Tokens<'ast, 'b>
impl<'ast, 'b> Iterator for Tokens<'ast, 'b> type Item = &'b TokenReference<'ast>;
&'b self
) -> (Vec<&'b Token<'ast>>, Vec<&'b Token<'ast>>) { ... } }
Expand description
Used to represent nodes such as tokens or function definitions
This trait is sealed and cannot be implemented for types outside of full-moon
Required methods
fn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
The start position of a node. None if can’t be determined
fn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
The end position of a node. None if it can’t be determined
Whether another node of the same type is the same as this one semantically, ignoring position
Provided methods
The full range of a node, if it has both start and end positions
The tokens surrounding a node that are ignored and not accessible through the node’s own accessors. Use this if you want to get surrounding comments or whitespace. Returns a tuple of the leading and trailing trivia.