Skip to main content

HclFunc

Trait HclFunc 

Source
pub trait HclFunc:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn call(&self, args: &[Value], cx: &CallCx<'_>) -> Result<Value, FuncError>;
}
Expand description

A single function dispatchable by the evaluator.

Implementations must be Send + Sync (the registry is shared across rayon worker threads per 99-key-decisions.md D14) and Debug (per CLAUDE.md § Type Design).

Required Methods§

Source

fn call(&self, args: &[Value], cx: &CallCx<'_>) -> Result<Value, FuncError>

Call the function with already-resolved arguments.

args is borrowed from the caller’s reduced expression tree. Returning Ok(Value) means the call site collapses to crate::ir::Expression::Literal; returning Err(_) keeps the call site as an unresolved crate::ir::Expression::FuncCall and the workspace records a diagnostic.

§Errors

See FuncError variants.

Implementors§