Skip to main content

Action

Trait Action 

Source
pub trait Action: Send + Sync {
    // Required methods
    fn action_type(&self) -> ActionType;
    fn execute(
        &self,
        step: &StepInfo,
        ctx: &HandlerContext<'_>,
        params: &Value,
        reporter: &mut Reporter<'_>,
        backend: Option<&mut dyn Backend>,
    ) -> Result<StepResult, ActionError>;

    // Provided methods
    fn apply_defaults(&self, _params: &mut Value, _step: &StepInfo) { ... }
    fn unsupported_params(
        &self,
        _params: &Value,
        _step: &StepInfo,
    ) -> Vec<String> { ... }
}
Expand description

Action trait, every ceremony step handler implements this.

Handlers emit facts and prompts through Reporter and return a StepResult. Transcript evidence is whatever facts the handler emits via Reporter::fact during execution; there is no separate evidence struct.

Required Methods§

Source

fn action_type(&self) -> ActionType

The action this handler implements, as the DSL names it.

Source

fn execute( &self, step: &StepInfo, ctx: &HandlerContext<'_>, params: &Value, reporter: &mut Reporter<'_>, backend: Option<&mut dyn Backend>, ) -> Result<StepResult, ActionError>

Execute the action.

§Errors

Returns ActionError when the handler cannot complete, when the operator aborts, or when the frontend disappears.

Provided Methods§

Source

fn apply_defaults(&self, _params: &mut Value, _step: &StepInfo)

Apply per-step parameter defaults before validation.

Source

fn unsupported_params(&self, _params: &Value, _step: &StepInfo) -> Vec<String>

Report values in a step’s with: block that this build cannot carry out, without executing the step.

Only build-relative findings belong here. Whether a value is one the action accepts at all is settled by rite_model::params::check, which the resolver runs, so that an editor linking no backend reports it too. What is left for a handler is the question only a linked binary can answer: whether the feature, backend or library that would carry the value out is present.

params holds the literal part of the block, as produced by literal_expr_value: a field whose value is an unevaluated expression is absent, because its value belongs to run time. Never report a field as missing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§