StepTrait

Trait StepTrait 

Source
pub trait StepTrait {
    // Required methods
    fn plan(&self, randomizer: &Randomizer) -> Result<Plan>;
    fn is_success(
        &self,
        execution_result: &Output,
        plan_ctx: &PlanCtx,
    ) -> Result<bool, &'static str>;
    fn to_yaml(&self) -> Value;

    // Provided methods
    fn setup(&self) -> Result<()> { ... }
    fn run_check(&self) -> Option<String> { ... }
    fn run_test(&self) -> Option<String> { ... }
}
Expand description

A trait that defines the behavior required for steps in the execution process.

Required Methods§

Source

fn plan(&self, randomizer: &Randomizer) -> Result<Plan>

Generates a plan for execution.

§Errors

when could not prepare the plan

Source

fn is_success( &self, execution_result: &Output, plan_ctx: &PlanCtx, ) -> Result<bool, &'static str>

Determines if the execution result indicates success for this step.

the bool result point if the runner should continue to the next steps or not.

§Errors

When plan result parsing is not the expected behavior.

Source

fn to_yaml(&self) -> Value

Serializes the step to a YAML representation.

Provided Methods§

Source

fn setup(&self) -> Result<()>

Prepares the setup by creating necessary directories and performing initialization steps.

§Errors

Returns an error if the setup fails, such as when it is unable to create the required directory.

Source

fn run_check(&self) -> Option<String>

Optionally returns a command to run as a check after the execution of the plan.

Source

fn run_test(&self) -> Option<String>

Optionally returns a command to run as a test after the execution of the plan.

Implementors§