Skip to main content

Action

Trait Action 

Source
pub trait Action {
    // Required methods
    fn execute(&self) -> Result<(), DotfilesError>;
    fn skip_in_ci(&self) -> bool;

    // Provided method
    fn check_conditions_and_execute(&self) -> Result<(), DotfilesError> { ... }
}
Expand description

An action to be run by the dotfiles runtime.

Required Methods§

Source

fn execute(&self) -> Result<(), DotfilesError>

Executes the action.

Returns an error String describing the issue, this string can be used to log or display to the user.

Source

fn skip_in_ci(&self) -> bool

Whether to skip this action in Continuous Integration environments.

See is_running_in_ci()

Provided Methods§

Source

fn check_conditions_and_execute(&self) -> Result<(), DotfilesError>

Checks that the conditions allow for executing this action, and if so executes it according to [execute(&self)].

If conditions don’t pass it simply skips and returns Ok(())

At this moment the only condition that is supported is whether the action should be skipped in CI, see [skip_in_ci(&self)].

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§