pub enum WorkflowStatement<N: TreeNode = SyntaxNode> {
Conditional(ConditionalStatement<N>),
Scatter(ScatterStatement<N>),
Call(CallStatement<N>),
Declaration(BoundDecl<N>),
}Expand description
Represents a statement in a workflow definition.
Variants§
Conditional(ConditionalStatement<N>)
The statement is a conditional statement.
Scatter(ScatterStatement<N>)
The statement is a scatter statement.
Call(CallStatement<N>)
The statement is a call statement.
Declaration(BoundDecl<N>)
The statement is a private bound declaration.
Implementations§
Source§impl<N: TreeNode> WorkflowStatement<N>
impl<N: TreeNode> WorkflowStatement<N>
Sourcepub fn can_cast(kind: SyntaxKind) -> bool
pub fn can_cast(kind: SyntaxKind) -> bool
Returns whether or not the given syntax kind can be cast to
WorkflowStatement.
Sourcepub fn cast(inner: N) -> Option<Self>
pub fn cast(inner: N) -> Option<Self>
Casts the given node to WorkflowStatement.
Returns None if the node cannot be cast.
Sourcepub fn as_conditional(&self) -> Option<&ConditionalStatement<N>>
pub fn as_conditional(&self) -> Option<&ConditionalStatement<N>>
Attempts to get a reference to the inner ConditionalStatement.
- If
selfis aWorkflowStatement::Conditional, then a reference to the innerConditionalStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_conditional(self) -> Option<ConditionalStatement<N>>
pub fn into_conditional(self) -> Option<ConditionalStatement<N>>
Consumes self and attempts to return the inner
ConditionalStatement.
- If
selfis aWorkflowStatement::Conditional, then the innerConditionalStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_conditional(self) -> ConditionalStatement<N>
pub fn unwrap_conditional(self) -> ConditionalStatement<N>
Unwraps the statement into a conditional statement.
§Panics
Panics if the statement is not a conditional statement.
Sourcepub fn as_scatter(&self) -> Option<&ScatterStatement<N>>
pub fn as_scatter(&self) -> Option<&ScatterStatement<N>>
Attempts to get a reference to the inner ScatterStatement.
- If
selfis aWorkflowStatement::Scatter, then a reference to the innerScatterStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_scatter(self) -> Option<ScatterStatement<N>>
pub fn into_scatter(self) -> Option<ScatterStatement<N>>
Consumes self and attempts to return the inner
ScatterStatement.
- If
selfis aWorkflowStatement::Scatter, then the innerScatterStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_scatter(self) -> ScatterStatement<N>
pub fn unwrap_scatter(self) -> ScatterStatement<N>
Unwraps the statement into a scatter statement.
§Panics
Panics if the statement is not a scatter statement.
Sourcepub fn as_call(&self) -> Option<&CallStatement<N>>
pub fn as_call(&self) -> Option<&CallStatement<N>>
Attempts to get a reference to the inner CallStatement.
- If
selfis aWorkflowStatement::Call, then a reference to the innerCallStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_call(self) -> Option<CallStatement<N>>
pub fn into_call(self) -> Option<CallStatement<N>>
Consumes self and attempts to return the inner
CallStatement.
- If
selfis aWorkflowStatement::Call, then the innerCallStatementis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_call(self) -> CallStatement<N>
pub fn unwrap_call(self) -> CallStatement<N>
Unwraps the statement into a call statement.
§Panics
Panics if the statement is not a call statement.
Sourcepub fn as_declaration(&self) -> Option<&BoundDecl<N>>
pub fn as_declaration(&self) -> Option<&BoundDecl<N>>
Attempts to get a reference to the inner BoundDecl.
- If
selfis aWorkflowStatement::Declaration, then a reference to the innerBoundDeclis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_declaration(self) -> Option<BoundDecl<N>>
pub fn into_declaration(self) -> Option<BoundDecl<N>>
Consumes self and attempts to return the inner
BoundDecl.
- If
selfis aWorkflowStatement::Declaration, then the innerBoundDeclis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_declaration(self) -> BoundDecl<N>
pub fn unwrap_declaration(self) -> BoundDecl<N>
Unwraps the statement into a bound declaration.
§Panics
Panics if the statement is not a bound declaration.
Sourcepub fn child(node: &N) -> Option<Self>
pub fn child(node: &N) -> Option<Self>
Finds the first child that can be cast to a WorkflowStatement.
Sourcepub fn children(node: &N) -> impl Iterator<Item = Self> + use<'_, N>
pub fn children(node: &N) -> impl Iterator<Item = Self> + use<'_, N>
Finds all children that can be cast to a WorkflowStatement.
Trait Implementations§
Source§impl<N: Clone + TreeNode> Clone for WorkflowStatement<N>
impl<N: Clone + TreeNode> Clone for WorkflowStatement<N>
Source§fn clone(&self) -> WorkflowStatement<N>
fn clone(&self) -> WorkflowStatement<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more