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§
Sourcefn action_type(&self) -> ActionType
fn action_type(&self) -> ActionType
The action this handler implements, as the DSL names it.
Sourcefn execute(
&self,
step: &StepInfo,
ctx: &HandlerContext<'_>,
params: &Value,
reporter: &mut Reporter<'_>,
backend: Option<&mut dyn Backend>,
) -> Result<StepResult, ActionError>
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§
Sourcefn apply_defaults(&self, _params: &mut Value, _step: &StepInfo)
fn apply_defaults(&self, _params: &mut Value, _step: &StepInfo)
Apply per-step parameter defaults before validation.
Sourcefn unsupported_params(&self, _params: &Value, _step: &StepInfo) -> Vec<String>
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".