Skip to main content

PatchAdapter

Trait PatchAdapter 

Source
pub trait PatchAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute(
        &self,
        label: &str,
        frame: &HashMap<String, Value>,
    ) -> Result<Value, String>;

    // Provided method
    fn execute_patch(
        &self,
        ctx: &PatchDispatchContext<'_>,
    ) -> Result<Value, String> { ... }
}
Expand description

Trait for patch/tool adapters. Implement to give dispatched patches a host execution target. Register via crate::AinlRuntime::register_adapter.

Label-keyed dispatch calls Self::execute_patch with a PatchDispatchContext. The default implementation delegates to Self::execute with the patch label and frame (back-compat for simple adapters). The reference GraphPatchAdapter overrides Self::execute_patch to emit a structured GraphPatch envelope (and optional host hook).

Required Methods§

Source

fn name(&self) -> &str

Canonical registry key (often the procedural IR label, e.g. bash or L_my_patch).

Source

fn execute( &self, label: &str, frame: &HashMap<String, Value>, ) -> Result<Value, String>

Legacy entrypoint; used by the default Self::execute_patch.

Provided Methods§

Source

fn execute_patch(&self, ctx: &PatchDispatchContext<'_>) -> Result<Value, String>

Rich dispatch context (node id, procedural payload, frame). Override for GraphPatch-style hosts.

Implementors§