pub enum SectionParent<N: TreeNode = SyntaxNode> {
Task(TaskDefinition<N>),
Workflow(WorkflowDefinition<N>),
Struct(StructDefinition<N>),
}Expand description
Represents the parent of a section.
Variants§
Task(TaskDefinition<N>)
The parent is a task.
Workflow(WorkflowDefinition<N>)
The parent is a workflow.
Struct(StructDefinition<N>)
The parent is a struct.
Implementations§
Source§impl<N: TreeNode> SectionParent<N>
impl<N: TreeNode> SectionParent<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
SectionParent.
Sourcepub fn cast(inner: N) -> Option<Self>
pub fn cast(inner: N) -> Option<Self>
Casts the given node to SectionParent.
Returns None if the node cannot be cast.
Sourcepub fn as_task(&self) -> Option<&TaskDefinition<N>>
pub fn as_task(&self) -> Option<&TaskDefinition<N>>
Attempts to get a reference to the inner TaskDefinition.
- If
selfis aSectionParent::Task, then a reference to the innerTaskDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_task(self) -> Option<TaskDefinition<N>>
pub fn into_task(self) -> Option<TaskDefinition<N>>
Consumes self and attempts to return the inner TaskDefinition.
- If
selfis aSectionParent::Task, then the innerTaskDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_task(self) -> TaskDefinition<N>
pub fn unwrap_task(self) -> TaskDefinition<N>
Sourcepub fn as_workflow(&self) -> Option<&WorkflowDefinition<N>>
pub fn as_workflow(&self) -> Option<&WorkflowDefinition<N>>
Attempts to get a reference to the inner WorkflowDefinition.
- If
selfis aSectionParent::Workflow, then a reference to the innerWorkflowDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_workflow(self) -> Option<WorkflowDefinition<N>>
pub fn into_workflow(self) -> Option<WorkflowDefinition<N>>
Consumes self and attempts to return the inner WorkflowDefinition.
- If
selfis aSectionParent::Workflow, then the innerWorkflowDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_workflow(self) -> WorkflowDefinition<N>
pub fn unwrap_workflow(self) -> WorkflowDefinition<N>
Sourcepub fn as_struct(&self) -> Option<&StructDefinition<N>>
pub fn as_struct(&self) -> Option<&StructDefinition<N>>
Attempts to get a reference to the inner StructDefinition.
- If
selfis aSectionParent::Struct, then a reference to the innerStructDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_struct(self) -> Option<StructDefinition<N>>
pub fn into_struct(self) -> Option<StructDefinition<N>>
Consumes self and attempts to return the inner StructDefinition.
- If
selfis aSectionParent::Struct, then the innerStructDefinitionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn unwrap_struct(self) -> StructDefinition<N>
pub fn unwrap_struct(self) -> StructDefinition<N>
Sourcepub fn child(node: &N) -> Option<Self>
pub fn child(node: &N) -> Option<Self>
Finds the first child that can be cast to a SectionParent.
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 SectionParent.
Trait Implementations§
Source§impl<N: Clone + TreeNode> Clone for SectionParent<N>
impl<N: Clone + TreeNode> Clone for SectionParent<N>
Source§fn clone(&self) -> SectionParent<N>
fn clone(&self) -> SectionParent<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<N: Eq + TreeNode> Eq for SectionParent<N>
impl<N: TreeNode> StructuralPartialEq for SectionParent<N>
Auto Trait Implementations§
impl<N> Freeze for SectionParent<N>where
N: Freeze,
impl<N> RefUnwindSafe for SectionParent<N>where
N: RefUnwindSafe,
impl<N> Send for SectionParent<N>where
N: Send,
impl<N> Sync for SectionParent<N>where
N: Sync,
impl<N> Unpin for SectionParent<N>where
N: Unpin,
impl<N> UnwindSafe for SectionParent<N>where
N: UnwindSafe,
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