pub struct AstPtr<N: AstNode> { /* private fields */ }Expand description
Like SyntaxNodePtr, but remembers the type of node.
Implementations§
Source§impl<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
Like Self::try_to_node but panics on failure.
Sourcepub fn try_to_node(&self, root: &SyntaxNode<N::Language>) -> Option<N>
pub fn try_to_node(&self, root: &SyntaxNode<N::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::Language>
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr<N::Language>
Returns the underlying SyntaxNodePtr.
Trait Implementations§
impl<N: AstNode> Eq for AstPtr<N>
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> 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