Skip to main content

TaskSkip

Struct TaskSkip 

Source
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

Source

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).

Source

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 implements Into<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.

Source

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 implements Into<String>, such as &str, String, or other string-like types.
§Returns

The modified TaskSkip instance with the message set.

Source

pub fn reason(&self) -> Option<&str>

Returns the machine-readable reason code, if available.

§Returns

Some(&str) if a reason was set, None otherwise.

Source

pub fn message(&self) -> Option<&str>

Returns the human-readable message, if available.

§Returns

Some(&str) if a message was set, None otherwise.

Trait Implementations§

Source§

impl Clone for TaskSkip

Source§

fn clone(&self) -> TaskSkip

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskSkip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TaskSkip

Source§

fn default() -> TaskSkip

Returns the “default value” for a type. Read more
Source§

impl Serialize for TaskSkip

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.