pub struct SyntaxNode(/* private fields */);Expand description
An opaque, navigable interior node of the CST.
Wraps rowan::SyntaxNode<RonLang>; the inner rowan type is never exposed.
Implementations§
Source§impl SyntaxNode
impl SyntaxNode
Sourcepub fn kind(&self) -> SyntaxKind
pub fn kind(&self) -> SyntaxKind
This node’s classification.
Sourcepub fn text_range(&self) -> TextRange
pub fn text_range(&self) -> TextRange
Absolute byte range spanned by this node (union of descendant tokens).
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
The full source text spanned by this node, including trivia, as a string.
Sourcepub fn parent(&self) -> Option<SyntaxNode>
pub fn parent(&self) -> Option<SyntaxNode>
Parent node, or None for the root.
Sourcepub fn children(&self) -> impl Iterator<Item = SyntaxNode>
pub fn children(&self) -> impl Iterator<Item = SyntaxNode>
Direct child nodes (excluding tokens), in source order.
Sourcepub fn children_with_tokens(&self) -> impl Iterator<Item = SyntaxElement>
pub fn children_with_tokens(&self) -> impl Iterator<Item = SyntaxElement>
Direct children (both nodes and tokens), in source order.
Sourcepub fn descendant_tokens(&self) -> impl Iterator<Item = SyntaxToken>
pub fn descendant_tokens(&self) -> impl Iterator<Item = SyntaxToken>
Every descendant token (leaves), in source order — the basis for printing.
Sourcepub fn first_token_of(&self, kind: SyntaxKind) -> Option<SyntaxToken>
pub fn first_token_of(&self, kind: SyntaxKind) -> Option<SyntaxToken>
First child token whose kind matches kind, if any.
Trait Implementations§
Source§impl Clone for SyntaxNode
impl Clone for SyntaxNode
Source§fn clone(&self) -> SyntaxNode
fn clone(&self) -> SyntaxNode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyntaxNode
impl Debug for SyntaxNode
impl Eq for SyntaxNode
Source§impl Hash for SyntaxNode
impl Hash for SyntaxNode
Source§impl PartialEq for SyntaxNode
impl PartialEq for SyntaxNode
impl StructuralPartialEq for SyntaxNode
Auto Trait Implementations§
impl !RefUnwindSafe for SyntaxNode
impl !Send for SyntaxNode
impl !Sync for SyntaxNode
impl !UnwindSafe for SyntaxNode
impl Freeze for SyntaxNode
impl Unpin for SyntaxNode
impl UnsafeUnpin for SyntaxNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more