pub enum Element<N = SyntaxNode<WorkflowDescriptionLanguage>>where
N: TreeNode,{
Node(Node<N>),
Token(Token<<N as TreeNode>::Token>),
}Expand description
An abstract syntax tree element.
Variants§
Node(Node<N>)
An abstract syntax tree node.
Token(Token<<N as TreeNode>::Token>)
An abstract syntax tree token.
Implementations§
Source§impl<N> Element<N>where
N: TreeNode,
impl<N> Element<N>where
N: TreeNode,
Sourcepub fn as_node(&self) -> Option<&Node<N>>
pub fn as_node(&self) -> Option<&Node<N>>
Attempts to get a reference to the inner Node.
- If
selfis aElement::Node, then a reference to the innerNodewrapped inSomeis returned. - Else,
Noneis returned.
Sourcepub fn into_node(self) -> Option<Node<N>>
pub fn into_node(self) -> Option<Node<N>>
Consumes self and attempts to return the inner Node.
- If
selfis aElement::Node, then the innerNodewrapped inSomeis returned. - Else,
Noneis returned.
Sourcepub fn unwrap_node(self) -> Node<N>
pub fn unwrap_node(self) -> Node<N>
Sourcepub fn as_token(&self) -> Option<&Token<<N as TreeNode>::Token>>
pub fn as_token(&self) -> Option<&Token<<N as TreeNode>::Token>>
Attempts to get a reference to the inner Token.
- If
selfis aElement::Token, then a reference to the innerTokenwrapped inSomeis returned. - Else,
Noneis returned.
Sourcepub fn into_token(self) -> Option<Token<<N as TreeNode>::Token>>
pub fn into_token(self) -> Option<Token<<N as TreeNode>::Token>>
Consumes self and attempts to return the inner Token.
- If
selfis aElement::Token, then the innerTokenwrapped inSomeis returned. - Else,
Noneis returned.
Sourcepub fn unwrap_token(self) -> Token<<N as TreeNode>::Token>
pub fn unwrap_token(self) -> Token<<N as TreeNode>::Token>
Sourcepub fn inner(&self) -> NodeOrToken<N, <N as TreeNode>::Token>
pub fn inner(&self) -> NodeOrToken<N, <N as TreeNode>::Token>
Gets the inner node or token from the Element.
Sourcepub fn kind(&self) -> SyntaxKind
pub fn kind(&self) -> SyntaxKind
Gets the underlying SyntaxKind from the Element.
Trait Implementations§
Source§impl AstElementFormatExt for Element
impl AstElementFormatExt for Element
Source§fn into_format_element(self) -> FormatElement
fn into_format_element(self) -> FormatElement
Auto Trait Implementations§
impl<N> Freeze for Element<N>
impl<N> RefUnwindSafe for Element<N>
impl<N> Send for Element<N>
impl<N> Sync for Element<N>
impl<N> Unpin for Element<N>
impl<N> UnwindSafe for Element<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more