Skip to main content

wire

Attribute Macro wire 

Source
#[wire]
Expand description

Derives JsonSchema for a struct or enum crossing a language boundary and registers it with wiretypes. On a type alias it registers the aliased type under the alias name; an alias over a non-std map also gets an {Alias}Wire twin over the std one, which a field of the alias type names in #[schemars(with = "..Wire")]. On a const or an immutable static whose type is Serialize and JsonSchema, it registers the value, which the targets spell as a literal; a LazyLock static is spelled as the value it builds.

Goes above the item’s #[derive(..)], whose Serialize/Deserialize decide the contract: Serialize describes what Rust sends, Deserialize alone what it accepts.