Skip to main content

Module conversion

Module conversion 

Source
Expand description

Runtime trait surface for converting Rust values to and from the recursive schema model.

The two core traits are:

Hand-written impls for the standard primitive set live below. Derived impls are generated by the golem-schema-derive crate, but the traits themselves can be implemented by hand for any type that needs a custom mapping.

Structs§

Quantity
A fixed-point decimal value with a unit, constrained by the QuantityUnit marker U. Encodes to the rich SchemaValue::Quantity.
SchemaBuilder
Mutable working set used while a graph is being built up.

Enums§

FromSchemaError
Errors produced by FromSchema::from_value.
MergeError
Errors produced by merge_agent_graphs.

Traits§

FromSchema
Decode a SchemaValue back into a Rust value.
IntoSchema
Convert a Rust type into a self-contained schema graph and a SchemaValue tree.
IntoTypedSchemaValue
Ergonomic value.into_typed_schema_value()? form of try_into_typed_schema_value, mirroring the legacy IntoValueAndType::into_value_and_type method shape.
QuantityUnit
Marker trait describing the unit constraints of a Quantity.

Functions§

binary_from_value
binary_to_value
default_type_id_from
Default TypeId derivation from a core::any::type_name::<Self>() output. Equivalent to normalize_type_path but exposed under a generated-code-friendly name.
merge_agent_graphs
Merge the named definitions from any number of per-root SchemaGraphs into a single agent-level graph.
normalize_type_path
Normalize a Rust path-form name into the dotted FQN used by TypeId.
path_from_value
path_to_value
text_from_value
text_to_value
try_into_schema_graph
Build a self-contained graph for T and run well-formedness validation on the result. Returns the first reported SchemaError if the graph is malformed.
try_into_typed_schema_value
Build a TypedSchemaValue — a self-contained SchemaGraph paired with the encoded SchemaValue tree — from a value whose type implements IntoSchema.
type_id_with_args
Build a TypeId for a generic instantiation. base is the already-normalized base name (e.g., "my_crate.Container") and args are the resolved argument TypeIds in declaration order.
url_from_value
url_to_value
value_kind
Stringify the kind of a SchemaValue for error messages.

Type Aliases§

DecodeError
Backwards-compatible alias kept for codegen and consumers.