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§
source§impl<N: AstNode> PartialEq for AstPtr<N>
impl<N: AstNode> PartialEq for AstPtr<N>
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