struct SyntaxPath {
child_indices: Vec<usize>,
}Expand description
A stable structural address expressed as children_with_token indices.
Fields§
§child_indices: Vec<usize>Implementations§
Source§impl SyntaxPath
impl SyntaxPath
Sourcefn new(element: &SyntaxElement) -> Self
fn new(element: &SyntaxElement) -> Self
Builds the root-relative path of element in its current tree.
Sourcefn resolve(&self, root: &SyntaxNode) -> Option<SyntaxElement>
fn resolve(&self, root: &SyntaxNode) -> Option<SyntaxElement>
Follows this path from root, returning None if the structure differs.
Sourcefn relative_to(&self, ancestor: &SyntaxPath) -> Option<SyntaxPath>
fn relative_to(&self, ancestor: &SyntaxPath) -> Option<SyntaxPath>
Removes ancestor’s prefix, yielding this path within that subtree.
Could have used LCA?
Sourcefn in_child(&self, index: usize, relative: &SyntaxPath) -> SyntaxPath
fn in_child(&self, index: usize, relative: &SyntaxPath) -> SyntaxPath
Appends an inserted child slot and a path relative to that child.
Sourcefn adjust_for_splice(
&mut self,
parent: &SyntaxPath,
deleted: &Range<usize>,
inserted: usize,
) -> bool
fn adjust_for_splice( &mut self, parent: &SyntaxPath, deleted: &Range<usize>, inserted: usize, ) -> bool
Updates this path for a splice and reports whether its element survives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyntaxPath
impl RefUnwindSafe for SyntaxPath
impl Send for SyntaxPath
impl Sync for SyntaxPath
impl Unpin for SyntaxPath
impl UnsafeUnpin for SyntaxPath
impl UnwindSafe for SyntaxPath
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,
§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> ⓘ
Converts
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> ⓘ
Converts
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