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§
- Func
Signature - A function signature extracted from Rust types.
- Interface
Impl - A declared and implemented interface.
Traits§
- Host
Func - Marker trait for host functions.
- Pack
Params - Trait for extracting parameter types from a tuple.
- Pack
Type - Trait for types that can be represented in Pack’s type system.