From 4387e44b9857d3ec7b17d661de3b40cbea4d6b09 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 31 Aug 2024 22:34:10 -0400 Subject: [PATCH] fix(rust): add missing TSNode functions --- lib/binding_rust/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/binding_rust/lib.rs b/lib/binding_rust/lib.rs index 971afc75..6bf58dd4 100644 --- a/lib/binding_rust/lib.rs +++ b/lib/binding_rust/lib.rs @@ -1381,6 +1381,20 @@ impl<'tree> Node<'tree> { Self::new(unsafe { ffi::ts_node_prev_named_sibling(self.0) }) } + /// Get the node's first child that extends beyond the given byte offset. + #[doc(alias = "ts_node_first_child_for_byte")] + #[must_use] + pub fn first_child_for_byte(&self, byte: usize) -> Option { + Self::new(unsafe { ffi::ts_node_first_child_for_byte(self.0, byte as u32) }) + } + + /// Get the node's first named child that extends beyond the given byte offset. + #[doc(alias = "ts_node_first_named_child_for_point")] + #[must_use] + pub fn first_named_child_for_byte(&self, byte: usize) -> Option { + Self::new(unsafe { ffi::ts_node_first_named_child_for_byte(self.0, byte as u32) }) + } + /// Get the node's number of descendants, including one for the node itself. #[doc(alias = "ts_node_descendant_count")] #[must_use]