pub enum SyntaxElement {
Node(SyntaxNode),
Token(SyntaxToken),
}Expand description
Either a SyntaxNode or a SyntaxToken — a child element in source order.
Variants§
Implementations§
Source§impl SyntaxElement
impl SyntaxElement
Sourcepub fn kind(&self) -> SyntaxKind
pub fn kind(&self) -> SyntaxKind
This element’s classification (node or token kind).
Sourcepub fn text_range(&self) -> TextRange
pub fn text_range(&self) -> TextRange
Absolute byte range spanned by this element.
Sourcepub fn as_node(&self) -> Option<&SyntaxNode>
pub fn as_node(&self) -> Option<&SyntaxNode>
Borrow as a node, if this element is a node.
Sourcepub fn as_token(&self) -> Option<&SyntaxToken>
pub fn as_token(&self) -> Option<&SyntaxToken>
Borrow as a token, if this element is a token.
Trait Implementations§
Source§impl Clone for SyntaxElement
impl Clone for SyntaxElement
Source§fn clone(&self) -> SyntaxElement
fn clone(&self) -> SyntaxElement
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyntaxElement
impl Debug for SyntaxElement
impl Eq for SyntaxElement
Source§impl Hash for SyntaxElement
impl Hash for SyntaxElement
Source§impl PartialEq for SyntaxElement
impl PartialEq for SyntaxElement
impl StructuralPartialEq for SyntaxElement
Auto Trait Implementations§
impl !RefUnwindSafe for SyntaxElement
impl !Send for SyntaxElement
impl !Sync for SyntaxElement
impl !UnwindSafe for SyntaxElement
impl Freeze for SyntaxElement
impl Unpin for SyntaxElement
impl UnsafeUnpin for SyntaxElement
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