pub struct AstPtr<N: AstNode> { /* private fields */ }
Expand description
Like SyntaxNodePtr
, but remembers the type of node.
Implementations
sourceimpl<N: AstNode> AstPtr<N>
impl<N: AstNode> AstPtr<N>
sourcepub fn to_node(&self, root: &SyntaxNode<N::Language>) -> N
pub fn to_node(&self, root: &SyntaxNode<N::Language>) -> N
Given the root node containing the node n
that self
is a pointer to,
returns n
. See SyntaxNodePtr::to_node
.
sourcepub fn syntax_node_ptr(&self) -> SyntaxNodePtr<N::Language>
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr<N::Language>
Returns the underlying SyntaxNodePtr
.
Trait Implementations
sourceimpl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr<N::Language>
impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr<N::Language>
sourcefn from(ptr: AstPtr<N>) -> SyntaxNodePtr<N::Language>
fn from(ptr: AstPtr<N>) -> SyntaxNodePtr<N::Language>
Converts to this type from the input type.
impl<N: AstNode> Eq for AstPtr<N>
Auto Trait Implementations
impl<N> RefUnwindSafe for AstPtr<N> where
<<N as AstNode>::Language as Language>::Kind: RefUnwindSafe,
impl<N> Send for AstPtr<N> where
<<N as AstNode>::Language as Language>::Kind: Send,
impl<N> Sync for AstPtr<N> where
<<N as AstNode>::Language as Language>::Kind: Sync,
impl<N> Unpin for AstPtr<N> where
<<N as AstNode>::Language as Language>::Kind: Unpin,
impl<N> UnwindSafe for AstPtr<N> where
<<N as AstNode>::Language as Language>::Kind: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more