pub trait Hook<P: PhaseMarker>: Send + Sync {
type Output: Captured + 'static;
type Config: Serialize + for<'de> Deserialize<'de>;
const ID: &'static str;
// Required methods
fn from_config(config: &Value, project_root: &Path) -> CapsulaResult<Self>
where Self: Sized;
fn config(&self) -> &Self::Config;
fn run(
&self,
metadata: &PreparedRun,
params: &RuntimeParams<P>,
) -> CapsulaResult<Self::Output>;
// Provided method
fn needs_artifact_dir(&self) -> bool { ... }
}Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn from_config(config: &Value, project_root: &Path) -> CapsulaResult<Self>where
Self: Sized,
fn from_config(config: &Value, project_root: &Path) -> CapsulaResult<Self>where
Self: Sized,
Create a hook instance from JSON configuration
fn config(&self) -> &Self::Config
fn run( &self, metadata: &PreparedRun, params: &RuntimeParams<P>, ) -> CapsulaResult<Self::Output>
Provided Methods§
Sourcefn needs_artifact_dir(&self) -> bool
fn needs_artifact_dir(&self) -> bool
Whether this hook needs a dedicated artifact directory.
When true, the orchestrator creates a directory under the run directory
(e.g., pre-0-capture-file/) and passes it via RuntimeParams::artifact_dir.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".