Skip to main content

Module wit

Module wit 

Source
Expand description

Round-trip conversion between the recursive in-memory tool metadata model in super and the flat, index-based golem:tool/common@0.1.0 wire bindings re-exported here as wire.

Mirrors crate::schema::wit: a tool’s defs plus every type embedded in its command tree are folded into one shared wire::SchemaGraph via GraphEncoder / GraphDecoder. Embedded SchemaTypes become type-node-index values into that graph, and embedded SchemaValue defaults / value-is literals become bare wire::SchemaValueTrees via encode_value / [decode_value].

Top-level fallible conversions are expressed as TryFrom impls, while conversions that need neither the shared graph nor fallible value decoding use From (see the “infallible, context-free conversions” section). Internal conversions that thread a shared GraphEncoder or GraphDecoder remain functions.

Modules§

wire
Generated golem:tool/common@0.1.0 types used as the wire shape.

Enums§

ToolWitError
Error raised when converting between the native tool model and its wire form.

Functions§

decode_tool
Decode a flat WIT tool representation into the recursive native model.
encode_tool
Encode a Tool into its flat WIT representation.
tool_middleware_from_wit
Decode tool middleware metadata from its WIT representation.
tool_middleware_to_wit
Encode tool middleware metadata into its WIT representation.