Struct ra_ap_syntax::AstPtr
source · [−]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>
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
sourceimpl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr
impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr
sourcefn from(ptr: AstPtr<N>) -> SyntaxNodePtr
fn from(ptr: AstPtr<N>) -> SyntaxNodePtr
Converts to this type from the input type.
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
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
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.