pub enum SyntaxStablePtr {
Root(FileId, GreenId),
Child {
parent: SyntaxStablePtrId,
kind: SyntaxKind,
key_fields: Vec<GreenId>,
index: usize,
},
}
Expand description
Stable pointer to a node in the syntax tree.
Has enough information to uniquely define a node in the AST, given the tree. Has undefined behavior when used with the wrong tree. This is not a real pointer in the low-level sense, just a representation of the path from the root to the node. Stable means that when the AST is changed, pointers of unchanged items tend to stay the same. For example, if a function is changed, the pointer of an unrelated function in the AST should remain the same, as much as possible.
Variants§
Root(FileId, GreenId)
The root node of the tree.
Child
A child node.
Fields
§
parent: SyntaxStablePtrId
The parent of the node.
§
kind: SyntaxKind
The SyntaxKind of the node.
Trait Implementations§
Source§impl Clone for SyntaxStablePtr
impl Clone for SyntaxStablePtr
Source§fn clone(&self) -> SyntaxStablePtr
fn clone(&self) -> SyntaxStablePtr
Returns a copy 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 SyntaxStablePtr
impl Debug for SyntaxStablePtr
Source§impl Hash for SyntaxStablePtr
impl Hash for SyntaxStablePtr
Source§impl<'a> Intern<'a, dyn SyntaxGroup + 'a, SyntaxStablePtrId> for SyntaxStablePtr
impl<'a> Intern<'a, dyn SyntaxGroup + 'a, SyntaxStablePtrId> for SyntaxStablePtr
fn intern( self, db: &(impl Upcast<dyn SyntaxGroup + 'a> + ?Sized), ) -> SyntaxStablePtrId
Source§impl<'a> LookupIntern<'a, dyn SyntaxGroup + 'a, SyntaxStablePtr> for SyntaxStablePtrId
impl<'a> LookupIntern<'a, dyn SyntaxGroup + 'a, SyntaxStablePtr> for SyntaxStablePtrId
fn lookup_intern( &self, db: &(impl Upcast<dyn SyntaxGroup + 'a> + ?Sized), ) -> SyntaxStablePtr
Source§impl PartialEq for SyntaxStablePtr
impl PartialEq for SyntaxStablePtr
impl Eq for SyntaxStablePtr
impl StructuralPartialEq for SyntaxStablePtr
Auto Trait Implementations§
impl Freeze for SyntaxStablePtr
impl RefUnwindSafe for SyntaxStablePtr
impl Send for SyntaxStablePtr
impl Sync for SyntaxStablePtr
impl Unpin for SyntaxStablePtr
impl UnwindSafe for SyntaxStablePtr
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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