Skip to main content

Module interface_impl

Module interface_impl 

Source
Expand description

Interface Implementation Builder

Provides a unified way to declare and implement host interfaces. The interface declaration and implementation are combined, ensuring they can never drift apart.

§Example

let interface = InterfaceImpl::new("theater:simple/runtime")
    .func("log", |ctx: &mut Ctx<State>, msg: String| {
        println!("{}", msg);
    })
    .func("get-state", |ctx: &mut Ctx<State>| -> String {
        ctx.data().state.clone()
    });

// Get the interface hash (computed from function signatures)
let hash = interface.hash();

// Register with a linker
builder.register_interface(&interface)?;

Structs§

FuncSignature
A function signature extracted from Rust types.
InterfaceImpl
A declared and implemented interface.

Traits§

HostFunc
Marker trait for host functions.
PackParams
Trait for extracting parameter types from a tuple.
PackType
Trait for types that can be represented in Pack’s type system.