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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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