pub struct CursorResource { /* private fields */ }Expand description
TS.2 backing for the tree-cursor WIT resource: a mutable position in the
tree, represented as a child-index path (the NodeResource scheme) so the
cursor stays a safe (snapshot, path) pair — no self-referential
tree_sitter::TreeCursor<'tree>.
Implementations§
Source§impl CursorResource
impl CursorResource
Sourcepub fn current_node(&self) -> NodeResource
pub fn current_node(&self) -> NodeResource
The node the cursor currently sits on.
Sourcepub fn current_field(&self) -> Option<String>
pub fn current_field(&self) -> Option<String>
The grammar field of the current node relative to its parent, or None
(root, or a child in no named field slot).
Sourcepub fn goto_first_named_child(&mut self) -> bool
pub fn goto_first_named_child(&mut self) -> bool
Move to the first NAMED child; false (no move) if there is none.
Sourcepub fn goto_next_named_sibling(&mut self) -> bool
pub fn goto_next_named_sibling(&mut self) -> bool
Move to the next NAMED sibling; false (no move) if there is none.
Sourcepub fn goto_parent(&mut self) -> bool
pub fn goto_parent(&mut self) -> bool
Move to the parent; false (no move) at the root.
Sourcepub fn reset(&mut self, node: &NodeResource)
pub fn reset(&mut self, node: &NodeResource)
Reposition onto node (assumed a node of the same snapshot).
Sourcepub fn reset_to_path(&mut self, path: Vec<u32>)
pub fn reset_to_path(&mut self, path: Vec<u32>)
Reposition onto the given root-relative child-index path. Used by the
host reset binding, which reads the target node’s path from the resource
table (avoiding a simultaneous borrow of the cursor and the node).
Auto Trait Implementations§
impl Freeze for CursorResource
impl RefUnwindSafe for CursorResource
impl Send for CursorResource
impl Sync for CursorResource
impl Unpin for CursorResource
impl UnsafeUnpin for CursorResource
impl UnwindSafe for CursorResource
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more