Skip to main content

dispatch_hook

Function dispatch_hook 

Source
pub fn dispatch_hook<H: Host>(
    program: &Program,
    path: &[String],
    args: Vec<Value>,
    host: &mut H,
    env: &mut Env,
) -> Result<Value, Diagnostic>
Expand description

Dispatch a hook event on a checked program.

path is the event path (e.g. ["pulse", "message"] for on pulse:message(…) or ["tick"] for on tick(…)). args are bound to the hook’s parameters in declaration order. Returns Ok(Value::Null) if no matching hook exists.