pub struct AstPtr<N>where
N: AstNode,{ /* private fields */ }Expand description
Like SyntaxNodePtr, but remembers the type of node.
Implementations§
Source§impl<N> AstPtr<N>where
N: AstNode,
impl<N> AstPtr<N>where
N: AstNode,
Sourcepub fn to_node(&self, root: &SyntaxNode<<N as AstNode>::Language>) -> N
pub fn to_node(&self, root: &SyntaxNode<<N as AstNode>::Language>) -> N
Like Self::try_to_node but panics on failure.
Sourcepub fn try_to_node(
&self,
root: &SyntaxNode<<N as AstNode>::Language>,
) -> Option<N>
pub fn try_to_node( &self, root: &SyntaxNode<<N as AstNode>::Language>, ) -> Option<N>
Given the root node containing the node n that self is a pointer to,
returns n if possible. See SyntaxNodePtr::try_to_node.
Sourcepub fn syntax_node_ptr(&self) -> SyntaxNodePtr<<N as AstNode>::Language>
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr<<N as AstNode>::Language>
Returns the underlying SyntaxNodePtr.
Trait Implementations§
impl<N> Eq for AstPtr<N>where
N: AstNode,
Auto Trait Implementations§
impl<N> Freeze for AstPtr<N>
impl<N> RefUnwindSafe for AstPtr<N>
impl<N> Send for AstPtr<N>
impl<N> Sync for AstPtr<N>
impl<N> Unpin for AstPtr<N>
impl<N> UnsafeUnpin for AstPtr<N>
impl<N> UnwindSafe for AstPtr<N>
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