Enum cstree::NodeOrToken [−][src]
Convenience type to represent tree elements which may either be a node or a token.
Used for both red and green tree, references to elements, …
Variants
Implementations
impl NodeOrToken<GreenNode, GreenToken>
[src]
pub fn kind(&self) -> SyntaxKind
[src]
Returns kind of this element.
pub fn text_len(&self) -> TextSize
[src]
Returns the length of the text covered by this element.
impl NodeOrToken<&'_ GreenNode, &'_ GreenToken>
[src]
pub fn kind(&self) -> SyntaxKind
[src]
Returns kind of this element.
pub fn text_len(self) -> TextSize
[src]
Returns the length of the text covered by this element.
impl<L: Language, D> NodeOrToken<SyntaxNode<L, D>, SyntaxToken<L, D>>
[src]
impl<'a, L: Language, D> NodeOrToken<&'a SyntaxNode<L, D>, &'a SyntaxToken<L, D>>
[src]
impl<L: Language, D> NodeOrToken<SyntaxNode<L, D>, SyntaxToken<L, D>>
[src]
pub fn text_range(&self) -> TextRange
[src]
The range this element covers in the source text, in bytes.
pub fn syntax_kind(&self) -> SyntaxKind
[src]
The internal representation of the kind of this element.
pub fn kind(&self) -> L::Kind
[src]
The kind of this element in terms of your language.
pub fn parent(&self) -> Option<&SyntaxNode<L, D>>
[src]
The parent node of this element, except if this element is the root.
pub fn ancestors(&self) -> impl Iterator<Item = &SyntaxNode<L, D>>
[src]
Returns an iterator along the chain of parents of this node.
pub fn first_token(&self) -> Option<&SyntaxToken<L, D>>
[src]
Return the leftmost token in the subtree of this element.
pub fn last_token(&self) -> Option<&SyntaxToken<L, D>>
[src]
Return the rightmost token in the subtree of this element.
pub fn next_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D>>
[src]
The tree element to the right of this one, i.e. the next child of this element’s parent after this element.
pub fn prev_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D>>
[src]
The tree element to the left of this one, i.e. the previous child of this element’s parent after this element.
impl<'a, L: Language, D> NodeOrToken<&'a SyntaxNode<L, D>, &'a SyntaxToken<L, D>>
[src]
pub fn text_range(&self) -> TextRange
[src]
The range this element covers in the source text, in bytes.
pub fn syntax_kind(&self) -> SyntaxKind
[src]
The internal representation of the kind of this element.
pub fn kind(&self) -> L::Kind
[src]
The kind of this element in terms of your language.
pub fn parent(&self) -> Option<&'a SyntaxNode<L, D>>
[src]
The parent node of this element, except if this element is the root.
pub fn ancestors(&self) -> impl Iterator<Item = &'a SyntaxNode<L, D>>
[src]
Returns an iterator along the chain of parents of this node.
pub fn first_token(&self) -> Option<&'a SyntaxToken<L, D>>
[src]
Return the leftmost token in the subtree of this element.
pub fn last_token(&self) -> Option<&'a SyntaxToken<L, D>>
[src]
Return the rightmost token in the subtree of this element.
pub fn next_sibling_or_token(&self) -> Option<SyntaxElementRef<'a, L, D>>
[src]
The tree element to the right of this one, i.e. the next child of this element’s parent after this element.
pub fn prev_sibling_or_token(&self) -> Option<SyntaxElementRef<'a, L, D>>
[src]
The tree element to the left of this one, i.e. the previous child of this element’s parent after this element.
impl<L: Language, D> NodeOrToken<ResolvedNode<L, D>, ResolvedToken<L, D>>
[src]
impl<L: Language, D> NodeOrToken<ResolvedNode<L, D>, ResolvedToken<L, D>>
[src]
pub fn text_range(&self) -> TextRange
[src]
The range this element covers in the source text, in bytes.
pub fn syntax_kind(&self) -> SyntaxKind
[src]
The internal representation of the kind of this element.
pub fn kind(&self) -> L::Kind
[src]
The kind of this element in terms of your language.
pub fn parent(&self) -> Option<&ResolvedNode<L, D>>
[src]
The parent node of this element, except if this element is the root.
pub fn ancestors(&self) -> impl Iterator<Item = &ResolvedNode<L, D>>
[src]
Returns an iterator along the chain of parents of this node.
pub fn first_token(&self) -> Option<&ResolvedToken<L, D>>
[src]
Return the leftmost token in the subtree of this element.
pub fn last_token(&self) -> Option<&ResolvedToken<L, D>>
[src]
Return the rightmost token in the subtree of this element.
pub fn next_sibling_or_token(&self) -> Option<ResolvedElementRef<'_, L, D>>
[src]
The tree element to the right of this one, i.e. the next child of this element’s parent after this element.
pub fn prev_sibling_or_token(&self) -> Option<ResolvedElementRef<'_, L, D>>
[src]
The tree element to the left of this one, i.e. the previous child of this element’s parent after this element.
impl<'a, L: Language, D> NodeOrToken<&'a ResolvedNode<L, D>, &'a ResolvedToken<L, D>>
[src]
pub fn text_range(&self) -> TextRange
[src]
The range this element covers in the source text, in bytes.
pub fn syntax_kind(&self) -> SyntaxKind
[src]
The internal representation of the kind of this element.
pub fn kind(&self) -> L::Kind
[src]
The kind of this element in terms of your language.
pub fn parent(&self) -> Option<&'a ResolvedNode<L, D>>
[src]
The parent node of this element, except if this element is the root.
pub fn ancestors(&self) -> impl Iterator<Item = &'a ResolvedNode<L, D>>
[src]
Returns an iterator along the chain of parents of this node.
pub fn first_token(&self) -> Option<&'a ResolvedToken<L, D>>
[src]
Return the leftmost token in the subtree of this element.
pub fn last_token(&self) -> Option<&'a ResolvedToken<L, D>>
[src]
Return the rightmost token in the subtree of this element.
pub fn next_sibling_or_token(&self) -> Option<ResolvedElementRef<'a, L, D>>
[src]
The tree element to the right of this one, i.e. the next child of this element’s parent after this element.
pub fn prev_sibling_or_token(&self) -> Option<ResolvedElementRef<'a, L, D>>
[src]
The tree element to the left of this one, i.e. the previous child of this element’s parent after this element.
impl<N, T> NodeOrToken<N, T>
[src]
pub fn into_node(self) -> Option<N>
[src]
pub fn into_token(self) -> Option<T>
[src]
pub fn as_node(&self) -> Option<&N>
[src]
pub fn as_token(&self) -> Option<&T>
[src]
Trait Implementations
impl<N: Clone, T: Clone> Clone for NodeOrToken<N, T>
[src]
fn clone(&self) -> NodeOrToken<N, T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<N: Copy, T: Copy> Copy for NodeOrToken<N, T>
[src]
impl<N: Debug, T: Debug> Debug for NodeOrToken<N, T>
[src]
impl<N: Display, T: Display> Display for NodeOrToken<N, T>
[src]
impl<N: Eq, T: Eq> Eq for NodeOrToken<N, T>
[src]
impl<'a> From<&'a GreenNode> for NodeOrToken<&'a GreenNode, &'a GreenToken>
[src]
fn from(node: &'a GreenNode) -> NodeOrToken<&'a GreenNode, &'a GreenToken>
[src]
impl<'a> From<&'a GreenToken> for NodeOrToken<&'a GreenNode, &'a GreenToken>
[src]
fn from(token: &'a GreenToken) -> NodeOrToken<&'a GreenNode, &'a GreenToken>
[src]
impl<'a, L: Language, D> From<&'a NodeOrToken<ResolvedNode<L, D>, ResolvedToken<L, D>>> for ResolvedElementRef<'a, L, D>
[src]
fn from(element: &'a ResolvedElement<L, D>) -> Self
[src]
impl<'a, L: Language, D> From<&'a NodeOrToken<SyntaxNode<L, D>, SyntaxToken<L, D>>> for SyntaxElementRef<'a, L, D>
[src]
fn from(element: &'a SyntaxElement<L, D>) -> Self
[src]
impl From<GreenNode> for NodeOrToken<GreenNode, GreenToken>
[src]
fn from(node: GreenNode) -> NodeOrToken<GreenNode, GreenToken>
[src]
impl From<GreenToken> for NodeOrToken<GreenNode, GreenToken>
[src]
fn from(token: GreenToken) -> NodeOrToken<GreenNode, GreenToken>
[src]
impl<N: Hash, T: Hash> Hash for NodeOrToken<N, T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<N: Ord, T: Ord> Ord for NodeOrToken<N, T>
[src]
fn cmp(&self, other: &NodeOrToken<N, T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<N: PartialEq, T: PartialEq> PartialEq<NodeOrToken<N, T>> for NodeOrToken<N, T>
[src]
fn eq(&self, other: &NodeOrToken<N, T>) -> bool
[src]
fn ne(&self, other: &NodeOrToken<N, T>) -> bool
[src]
impl<N: PartialOrd, T: PartialOrd> PartialOrd<NodeOrToken<N, T>> for NodeOrToken<N, T>
[src]
fn partial_cmp(&self, other: &NodeOrToken<N, T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<N, T> StructuralEq for NodeOrToken<N, T>
[src]
impl<N, T> StructuralPartialEq for NodeOrToken<N, T>
[src]
Auto Trait Implementations
impl<N, T> RefUnwindSafe for NodeOrToken<N, T> where
N: RefUnwindSafe,
T: RefUnwindSafe,
N: RefUnwindSafe,
T: RefUnwindSafe,
impl<N, T> Send for NodeOrToken<N, T> where
N: Send,
T: Send,
N: Send,
T: Send,
impl<N, T> Sync for NodeOrToken<N, T> where
N: Sync,
T: Sync,
N: Sync,
T: Sync,
impl<N, T> Unpin for NodeOrToken<N, T> where
N: Unpin,
T: Unpin,
N: Unpin,
T: Unpin,
impl<N, T> UnwindSafe for NodeOrToken<N, T> where
N: UnwindSafe,
T: UnwindSafe,
N: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,