pub trait HookStep: Send {
// Required methods
fn event_name(&self) -> &'static str;
fn to_envelope(&self) -> Value;
fn apply_verdict(
&mut self,
verdict: &Value,
) -> Result<HookControl, VerdictError>;
}Expand description
The step state for a mount point. Consumed by two kinds of hooks:
- Internal Rust hook: takes
&mut Selfdirectly, mutates fields to inject data, and returns aHookControlon its own. - User-configured hook:
Self::to_envelopeproduces JSON fed to stdin/templates; the handler outputs JSON, whichSelf::apply_verdictapplies back to the step (mutating data) and parses into aHookControl.
Required Methods§
Sourcefn event_name(&self) -> &'static str
fn event_name(&self) -> &'static str
Event name (snake_case). Used in envelope headers and matchers.
Sourcefn to_envelope(&self) -> Value
fn to_envelope(&self) -> Value
Projects the step into an input envelope — fed to command stdin / prompt templates. Contains a common header plus step-specific fields.
Sourcefn apply_verdict(
&mut self,
verdict: &Value,
) -> Result<HookControl, VerdictError>
fn apply_verdict( &mut self, verdict: &Value, ) -> Result<HookControl, VerdictError>
Apply the handler’s output verdict (JSON) back to this step: parse the common
control / additional_context fields, then handle the step-specific “fill
output” fields. Returns a control directive.
§Errors
Returns VerdictError if the verdict’s control is an unknown value or the
step-specific fields are malformed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".