Struct ra_ap_syntax::AstPtr
source · 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>
pub fn new(node: &N) -> AstPtr<N>
pub fn to_node(&self, root: &SyntaxNode) -> N
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr
pub fn text_range(&self) -> TextRange
pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>>
pub fn upcast<M: AstNode>(self) -> AstPtr<M>where N: Into<M>,
sourcepub fn try_from_raw(raw: SyntaxNodePtr) -> Option<AstPtr<N>>
pub fn try_from_raw(raw: SyntaxNodePtr) -> Option<AstPtr<N>>
Like SyntaxNodePtr::cast but the trait bounds work out.
Trait Implementations§
source§impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr
impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr
source§fn from(ptr: AstPtr<N>) -> SyntaxNodePtr
fn from(ptr: AstPtr<N>) -> SyntaxNodePtr
Converts to this type from the input type.
source§impl<N: AstNode> PartialEq<AstPtr<N>> for AstPtr<N>
impl<N: AstNode> PartialEq<AstPtr<N>> for AstPtr<N>
impl<N: AstNode> Eq for AstPtr<N>
Auto Trait Implementations§
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.