Hook

Trait Hook 

Source
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>;
}

Required Associated Constants§

Source

const ID: &'static str

The unique identifier for this hook type (e.g., “capture-cwd”, “notify-slack”)

Required Associated Types§

Source

type Output: Captured + 'static

Source

type Config: Serialize + for<'de> Deserialize<'de>

Required Methods§

Source

fn from_config(config: &Value, project_root: &Path) -> CapsulaResult<Self>
where Self: Sized,

Create a hook instance from JSON configuration

Source

fn config(&self) -> &Self::Config

Source

fn run( &self, metadata: &PreparedRun, params: &RuntimeParams<P>, ) -> CapsulaResult<Self::Output>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§