pub trait NodeTrait<'a>: Sized + SourceRanged {
Show 28 methods
// Required methods
fn parent(&self) -> Option<Node<'a>>;
fn children(&self) -> Vec<Node<'a>>;
fn as_node(&self) -> Node<'a>;
fn kind(&self) -> NodeKind;
// Provided methods
fn ancestors(&self) -> AncestorIterator<'a> ⓘ { ... }
fn start_line(&self) -> usize { ... }
fn end_line(&self) -> usize { ... }
fn start_column(&self) -> usize { ... }
fn end_column(&self) -> usize { ... }
fn char_width(&self) -> usize { ... }
fn child_index(&self) -> usize { ... }
fn previous_sibling(&self) -> Option<Node<'a>> { ... }
fn previous_siblings(&self) -> Vec<Node<'a>> { ... }
fn next_sibling(&self) -> Option<Node<'a>> { ... }
fn next_siblings(&self) -> Vec<Node<'a>> { ... }
fn tokens(&self) -> &'a [TokenAndSpan] { ... }
fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>> { ... }
fn children_with_tokens_fast(
&self,
program: impl RootNode<'a>,
) -> Vec<NodeOrToken<'a>> { ... }
fn leading_comments(&self) -> CommentsIterator<'a> ⓘ { ... }
fn trailing_comments(&self) -> CommentsIterator<'a> ⓘ { ... }
fn program(&self) -> Program<'a> { ... }
fn module(&self) -> &Module<'a> { ... }
fn script(&self) -> &Script<'a> { ... }
fn text(&self) -> &'a str { ... }
fn previous_token(&self) -> Option<&'a TokenAndSpan> { ... }
fn next_token(&self) -> Option<&'a TokenAndSpan> { ... }
fn previous_tokens(&self) -> &'a [TokenAndSpan] { ... }
fn next_tokens(&self) -> &'a [TokenAndSpan] { ... }
}
Required Methods§
fn parent(&self) -> Option<Node<'a>>
fn children(&self) -> Vec<Node<'a>>
fn as_node(&self) -> Node<'a>
fn kind(&self) -> NodeKind
Provided Methods§
fn ancestors(&self) -> AncestorIterator<'a> ⓘ
fn start_line(&self) -> usize
fn end_line(&self) -> usize
fn start_column(&self) -> usize
fn end_column(&self) -> usize
fn char_width(&self) -> usize
fn child_index(&self) -> usize
fn previous_sibling(&self) -> Option<Node<'a>>
sourcefn previous_siblings(&self) -> Vec<Node<'a>>
fn previous_siblings(&self) -> Vec<Node<'a>>
Gets the previous siblings in the order they appear in the file.
sourcefn next_sibling(&self) -> Option<Node<'a>>
fn next_sibling(&self) -> Option<Node<'a>>
Gets the next siblings in the order they appear in the file.
fn next_siblings(&self) -> Vec<Node<'a>>
fn tokens(&self) -> &'a [TokenAndSpan]
fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>>
fn children_with_tokens_fast( &self, program: impl RootNode<'a>, ) -> Vec<NodeOrToken<'a>>
fn leading_comments(&self) -> CommentsIterator<'a> ⓘ
fn trailing_comments(&self) -> CommentsIterator<'a> ⓘ
sourcefn module(&self) -> &Module<'a>
fn module(&self) -> &Module<'a>
Gets the root node if the view was created from a Module; otherwise panics.
sourcefn script(&self) -> &Script<'a>
fn script(&self) -> &Script<'a>
Gets the root node if the view was created from a Script; otherwise panics.
fn text(&self) -> &'a str
fn previous_token(&self) -> Option<&'a TokenAndSpan>
fn next_token(&self) -> Option<&'a TokenAndSpan>
sourcefn previous_tokens(&self) -> &'a [TokenAndSpan]
fn previous_tokens(&self) -> &'a [TokenAndSpan]
Gets the previous tokens in the order they appear in the file.
sourcefn next_tokens(&self) -> &'a [TokenAndSpan]
fn next_tokens(&self) -> &'a [TokenAndSpan]
Gets the next tokens in the order they appear in the file.
Object Safety§
This trait is not object safe.