pub struct TaskSkip { /* private fields */ }Expand description
Represents information about a skipped task execution.
TaskSkip captures details about why a task was not executed on a host.
Tasks can be skipped for various reasons, such as conditional logic (when clauses),
failed dependencies, maintenance mode, or other runtime conditions that prevent
execution. This structure provides both a machine-readable reason and a human-readable
message to explain the skip.
§Fields
-
reason- An optional machine-readable reason code or identifier explaining why the task was skipped (e.g., “parent_failed”, “condition_not_met”, “maintenance_mode”). -
message- An optional human-readable message providing additional context about why the task was skipped.
§Example
use genja_core::task::TaskSkip;
let skip = TaskSkip::new()
.with_reason("condition_not_met")
.with_message("Host is not in the target environment");
assert_eq!(skip.reason(), Some("condition_not_met"));
assert_eq!(skip.message(), Some("Host is not in the target environment"));Implementations§
Source§impl TaskSkip
impl TaskSkip
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new TaskSkip instance with default values.
This constructor initializes a TaskSkip with no reason or message set.
Both fields will be None until explicitly set using the builder methods.
§Returns
A new TaskSkip instance with default values (no reason or message).
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
Sets the machine-readable reason code explaining why the task was skipped.
This is a builder method that consumes self and returns the modified instance,
allowing for method chaining. The reason should be a concise identifier that
can be used programmatically to categorize or filter skipped tasks.
§Parameters
reason- A machine-readable reason code or identifier. Can be any type that implementsInto<String>, such as&str,String, or other string-like types. Common examples include “condition_not_met”, “parent_failed”, or “maintenance_mode”.
§Returns
The modified TaskSkip instance with the reason set.
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Sets a human-readable message providing additional context about why the task was skipped.
This is a builder method that consumes self and returns the modified instance,
allowing for method chaining. The message should provide clear, user-friendly
information about why the task was not executed.
§Parameters
message- A human-readable explanation message. Can be any type that implementsInto<String>, such as&str,String, or other string-like types.
§Returns
The modified TaskSkip instance with the message set.