pub struct NodeHandle {
pub kind: String,
pub text: String,
pub span: (u32, u32),
}Expand description
Lifetime-free node handle for output.
Captures enough information to represent a node without holding a reference to the tree.
Fields§
§kind: StringNode kind name (e.g., “identifier”, “number”).
text: StringSource text of the node.
span: (u32, u32)Byte span [start, end).
Implementations§
Source§impl NodeHandle
impl NodeHandle
Sourcepub fn from_node(node: Node<'_>, source: &str) -> NodeHandle
pub fn from_node(node: Node<'_>, source: &str) -> NodeHandle
Create from a tree-sitter node and source text.
Trait Implementations§
Source§impl Clone for NodeHandle
impl Clone for NodeHandle
Source§fn clone(&self) -> NodeHandle
fn clone(&self) -> NodeHandle
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 Debug for NodeHandle
impl Debug for NodeHandle
Source§impl PartialEq for NodeHandle
impl PartialEq for NodeHandle
Source§impl Serialize for NodeHandle
impl Serialize for NodeHandle
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for NodeHandle
impl StructuralPartialEq for NodeHandle
Auto Trait Implementations§
impl Freeze for NodeHandle
impl RefUnwindSafe for NodeHandle
impl Send for NodeHandle
impl Sync for NodeHandle
impl Unpin for NodeHandle
impl UnwindSafe for NodeHandle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.