Skip to main content

Module form

Module form 

Source
Expand description

Struct↔schema contracts and value bridging for the opt-in formars-derive crate. Struct↔schema contracts and value bridging used by the opt-in formars-derive crate — macro-free, dependency-free additions to core.

Two small traits with disjoint duties:

  • FormSchema connects a Rust struct to its companion schema (nesting). It lives in core because proc-macro crates cannot export runtime items.
  • FormBridge connects a Rust value to the erased Value tree in both directions (typed-parse bridging), so plain primitives can participate in derived reconstruction without deriving anything.

Traits§

FormBridge
Lossless Rust-value ↔ Value bridging used by generated typed parses: to_form_value feeds the composed object schema; from_validated reconstructs fields from validated output. Total on validated outputs — returns None only on an invariant breach or wrong-variant input.
FormSchema
Connects a Rust struct to its companion schema.