pub enum TaskItem<N: TreeNode = SyntaxNode> {
Input(InputSection<N>),
Output(OutputSection<N>),
Command(CommandSection<N>),
Requirements(RequirementsSection<N>),
Hints(TaskHintsSection<N>),
Runtime(RuntimeSection<N>),
Metadata(MetadataSection<N>),
ParameterMetadata(ParameterMetadataSection<N>),
Declaration(BoundDecl<N>),
}Expand description
Represents an item in a task definition.
Variants§
Input(InputSection<N>)
The item is an input section.
Output(OutputSection<N>)
The item is an output section.
Command(CommandSection<N>)
The item is a command section.
Requirements(RequirementsSection<N>)
The item is a requirements section.
Hints(TaskHintsSection<N>)
The item is a task hints section.
Runtime(RuntimeSection<N>)
The item is a runtime section.
Metadata(MetadataSection<N>)
The item is a metadata section.
ParameterMetadata(ParameterMetadataSection<N>)
The item is a parameter meta section.
Declaration(BoundDecl<N>)
The item is a private bound declaration.
Implementations§
Source§impl<N: TreeNode> TaskItem<N>
impl<N: TreeNode> TaskItem<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
TaskItem.
Sourcepub fn cast(inner: N) -> Option<Self>
pub fn cast(inner: N) -> Option<Self>
Casts the given node to TaskItem.
Returns None if the node cannot be cast.
Sourcepub fn as_input_section(&self) -> Option<&InputSection<N>>
pub fn as_input_section(&self) -> Option<&InputSection<N>>
Attempts to get a reference to the inner InputSection.
- If
selfis aTaskItem::Input, then a reference to the innerInputSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_input_section(self) -> Option<InputSection<N>>
pub fn into_input_section(self) -> Option<InputSection<N>>
Consumes self and attempts to return the inner InputSection.
- If
selfis aTaskItem::Input, then the innerInputSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_output_section(&self) -> Option<&OutputSection<N>>
pub fn as_output_section(&self) -> Option<&OutputSection<N>>
Attempts to get a reference to the inner OutputSection.
- If
selfis aTaskItem::Output, then a reference to the innerOutputSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_output_section(self) -> Option<OutputSection<N>>
pub fn into_output_section(self) -> Option<OutputSection<N>>
Consumes self and attempts to return the inner OutputSection.
- If
selfis aTaskItem::Output, then the innerOutputSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_command_section(&self) -> Option<&CommandSection<N>>
pub fn as_command_section(&self) -> Option<&CommandSection<N>>
Attempts to get a reference to the inner CommandSection.
- If
selfis aTaskItem::Command, then a reference to the innerCommandSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_command_section(self) -> Option<CommandSection<N>>
pub fn into_command_section(self) -> Option<CommandSection<N>>
Consumes self and attempts to return the inner CommandSection.
- If
selfis aTaskItem::Command, then the innerCommandSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_requirements_section(&self) -> Option<&RequirementsSection<N>>
pub fn as_requirements_section(&self) -> Option<&RequirementsSection<N>>
Attempts to get a reference to the inner RequirementsSection.
- If
selfis aTaskItem::Requirements, then a reference to the innerRequirementsSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_requirements_section(self) -> Option<RequirementsSection<N>>
pub fn into_requirements_section(self) -> Option<RequirementsSection<N>>
Consumes self and attempts to return the inner
RequirementsSection.
- If
selfis aTaskItem::Requirements, then the innerRequirementsSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_hints_section(&self) -> Option<&TaskHintsSection<N>>
pub fn as_hints_section(&self) -> Option<&TaskHintsSection<N>>
Attempts to get a reference to the inner TaskHintsSection.
- If
selfis aTaskItem::Hints, then a reference to the innerTaskHintsSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_hints_section(self) -> Option<TaskHintsSection<N>>
pub fn into_hints_section(self) -> Option<TaskHintsSection<N>>
Consumes self and attempts to return the inner TaskHintsSection.
- If
selfis aTaskItem::Hints, then the innerTaskHintsSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_runtime_section(&self) -> Option<&RuntimeSection<N>>
pub fn as_runtime_section(&self) -> Option<&RuntimeSection<N>>
Attempts to get a reference to the inner RuntimeSection.
- If
selfis aTaskItem::Runtime, then a reference to the innerRuntimeSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_runtime_section(self) -> Option<RuntimeSection<N>>
pub fn into_runtime_section(self) -> Option<RuntimeSection<N>>
Consumes self and attempts to return the inner RuntimeSection.
- If
selfis aTaskItem::Runtime, then the innerRuntimeSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_metadata_section(&self) -> Option<&MetadataSection<N>>
pub fn as_metadata_section(&self) -> Option<&MetadataSection<N>>
Attempts to get a reference to the inner MetadataSection.
- If
selfis aTaskItem::Metadata, then a reference to the innerMetadataSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_metadata_section(self) -> Option<MetadataSection<N>>
pub fn into_metadata_section(self) -> Option<MetadataSection<N>>
Consumes self and attempts to return the inner MetadataSection.
- If
selfis aTaskItem::Metadata, then the innerMetadataSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn as_parameter_metadata_section(
&self,
) -> Option<&ParameterMetadataSection<N>>
pub fn as_parameter_metadata_section( &self, ) -> Option<&ParameterMetadataSection<N>>
Attempts to get a reference to the inner ParameterMetadataSection.
- If
selfis aTaskItem::ParameterMetadata, then a reference to the innerParameterMetadataSectionis returned wrapped inSome. - Else,
Noneis returned.
Sourcepub fn into_parameter_metadata_section(
self,
) -> Option<ParameterMetadataSection<N>>
pub fn into_parameter_metadata_section( self, ) -> Option<ParameterMetadataSection<N>>
Consumes self and attempts to return the inner
ParameterMetadataSection.
- If
selfis aTaskItem::ParameterMetadata, then the innerParameterMetadataSectionis returned wrapped inSome. - Else,
Noneis returned.
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 aTaskItem::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 aTaskItem::Declaration, then the innerBoundDeclis returned wrapped inSome. - Else,
Noneis returned.