pub struct UntypedNode<'tree>(/* private fields */);Expand description
Implementations§
Source§impl<'tree> UntypedNode<'tree>
impl<'tree> UntypedNode<'tree>
Sourcepub fn new(node: Node<'tree>) -> Self
pub fn new(node: Node<'tree>) -> Self
Wrap the tree-sitter node so that it can be used wherever a Node can, but provides no
type guarantees.
Sourcepub fn ref<'a>(node: &'a Node<'tree>) -> &'a Self
pub fn ref<'a>(node: &'a Node<'tree>) -> &'a Self
Convert a reference to a tree-sitter node into one of an untyped node.
This is a transmute, but safe since they have the same representation.
Sourcepub fn mut<'a>(node: &'a mut Node<'tree>) -> &'a mut Self
pub fn mut<'a>(node: &'a mut Node<'tree>) -> &'a mut Self
Convert a mutable reference to a tree-sitter node into one of an untyped node.
This is a transmute, but safe since they have the same representation.
Sourcepub fn is_missing(&self) -> bool
pub fn is_missing(&self) -> bool
Is this a missing node?
Sourcepub fn downcast<Type: Node<'tree>>(&self) -> NodeResult<'_, Type>
pub fn downcast<Type: Node<'tree>>(&self) -> NodeResult<'_, Type>
Try to downcast to the given type.
See Node::try_from_raw.
Trait Implementations§
Source§impl<'tree> Clone for UntypedNode<'tree>
impl<'tree> Clone for UntypedNode<'tree>
Source§fn clone(&self) -> UntypedNode<'tree>
fn clone(&self) -> UntypedNode<'tree>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'tree> Debug for UntypedNode<'tree>
impl<'tree> Debug for UntypedNode<'tree>
Source§impl<'tree> From<Node<'tree>> for UntypedNode<'tree>
impl<'tree> From<Node<'tree>> for UntypedNode<'tree>
Source§impl<'tree> Hash for UntypedNode<'tree>
impl<'tree> Hash for UntypedNode<'tree>
Source§impl<'tree> Node<'tree> for UntypedNode<'tree>
impl<'tree> Node<'tree> for UntypedNode<'tree>
Source§type WithLifetime<'a> = UntypedNode<'a>
type WithLifetime<'a> = UntypedNode<'a>
The same type, but with a different lifetime.
Source§fn try_from_raw(node: Node<'tree>) -> NodeResult<'tree, Self>
fn try_from_raw(node: Node<'tree>) -> NodeResult<'tree, Self>
Check that the tree-sitter node is the correct kind, and if it is, wrap. Read more
Source§unsafe fn from_raw_unchecked(node: Node<'tree>) -> Self
unsafe fn from_raw_unchecked(node: Node<'tree>) -> Self
Assume that tree-sitter node is the correct kind and wrap. Read more
Source§fn raw_mut(&mut self) -> &mut Node<'tree>
fn raw_mut(&mut self) -> &mut Node<'tree>
The wrapped tree-sitter node (mutable reference, rarely needed). Read more
Source§fn upcast(self) -> UntypedNode<'tree>
fn upcast(self) -> UntypedNode<'tree>
Upcast into an untyped node. Read more
Source§fn utf16_text<'a>(&self, source: &'a [u16]) -> &'a [u16]
fn utf16_text<'a>(&self, source: &'a [u16]) -> &'a [u16]
Source§fn prefixes(&self) -> impl Iterator<Item = UntypedNode<'tree>>
fn prefixes(&self) -> impl Iterator<Item = UntypedNode<'tree>>
Source§fn suffixes(&self) -> impl Iterator<Item = UntypedNode<'tree>>
fn suffixes(&self) -> impl Iterator<Item = UntypedNode<'tree>>
Source§fn walk(&self) -> TreeCursor<'tree>
fn walk(&self) -> TreeCursor<'tree>
Get a cursor for this node
Source§fn parent(&self) -> Option<UntypedNode<'tree>>
fn parent(&self) -> Option<UntypedNode<'tree>>
Get the node’s immediate parent
Source§fn next_named_sibling(&self) -> Option<UntypedNode<'tree>>
fn next_named_sibling(&self) -> Option<UntypedNode<'tree>>
Get the node’s immediate named next sibling
Source§fn prev_named_sibling(&self) -> Option<UntypedNode<'tree>>
fn prev_named_sibling(&self) -> Option<UntypedNode<'tree>>
Get the node’s immediate named previous sibling
Source§fn named_child_count(&self) -> usize
fn named_child_count(&self) -> usize
Get the number of named children
Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
Get this node’s tree-sitter name. See tree-sitter’s
Node::kindSource§fn is_named(&self) -> bool
fn is_named(&self) -> bool
Check if this node is named. See tree-sitter’s
Node::is_namedSource§fn has_changes(&self) -> bool
fn has_changes(&self) -> bool
Check if this node has been edited
Source§fn has_error(&self) -> bool
fn has_error(&self) -> bool
Check if this node represents a syntax error or contains any syntax errors anywhere within
it
Source§fn start_byte(&self) -> usize
fn start_byte(&self) -> usize
Get the byte offset where this node starts
Source§fn start_position(&self) -> Point
fn start_position(&self) -> Point
Get the row and column where this node starts
Source§fn end_position(&self) -> Point
fn end_position(&self) -> Point
Get the row and column where this node ends
Source§fn range(&self) -> Range
fn range(&self) -> Range
Get the byte range and row and column range where this node is located
Source§fn byte_range(&self) -> Range<usize>
fn byte_range(&self) -> Range<usize>
Get the byte range where this node is located
Source§fn edit(&mut self, edit: &InputEdit)
fn edit(&mut self, edit: &InputEdit)
Edit this node to keep it in-sync with source code that has been edited. See
tree-sitter’s
Node::editSource§impl<'tree> PartialEq for UntypedNode<'tree>
impl<'tree> PartialEq for UntypedNode<'tree>
impl<'tree> Copy for UntypedNode<'tree>
impl<'tree> Eq for UntypedNode<'tree>
impl<'tree> StructuralPartialEq for UntypedNode<'tree>
Auto Trait Implementations§
impl<'tree> Freeze for UntypedNode<'tree>
impl<'tree> RefUnwindSafe for UntypedNode<'tree>
impl<'tree> Send for UntypedNode<'tree>
impl<'tree> Sync for UntypedNode<'tree>
impl<'tree> Unpin for UntypedNode<'tree>
impl<'tree> UnwindSafe for UntypedNode<'tree>
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