Skip to main content

Module schema

Module schema 

Source
Expand description

Unified Schema primitive — fields and layout blocks that compose via view!.

Schema holds layout blocks, embedded values, and Field slots and resolves every field once into one list for rendering and validation.

lens_field reaches into toasty_core (upstream issue #114); retire the walk when Toasty exposes it (upstream #183).

Re-exports§

pub use lenses::declare;

Structs§

ChoiceField
A choice field: Field::choice.
ControlInput
What a Control renders for one form: the field’s key, its current value, and its validation state.
CustomField
A field an app’s Control renders: Field::custom and Field::toggle.
Field
One form field binding a lens to the control editing it, offering only that control’s modifiers so a modifier on the wrong control does not compile.
FileField
A file field: Field::file.
Grid
Holds a column container with cols clamped to 1..12.
Group
Holds an unlabelled container for grouping fields.
Repeater
Holds a nested Schema rendered once as a titled group and reports a required empty group under its label.
Schema
Composes fields and layout blocks and resolves every field once into one list.
Section
Holds a titled container with an optional child Schema.
Source
Holds where a schema render reads field values and errors from for a form or a read-only view.
TextField
A text field: Field::text.
Toggle
Renders a bool field as a checkbox preceded by a hidden false, displaying as "Yes"/"No".

Constants§

MAX_RELATIONSHIP_OPTIONS
Caps the options a relationship choice field loads instead of scanning a large table per select.

Traits§

Control
Renders a field’s input from a ControlInput and its stored value for display, using a hidden field for a state that submits nothing.
EmbeddedForm
Reads an embedded value from and writes it to the flat form map; derive it to generate the value’s schema.
IntoOptions
A choice’s static options as (value, label) pairs, in display order.
IntoSchema
Converts a field, a layout block, a tuple of either, or a schema into a Schema.
OptionSource
Describes the source a relationship option loader reads.
Options
A closed set of stored values, each with its label.
TypedValue
Parses a typed column’s text submission and names the type in the error it produces.

Functions§

declare
Run declarations with db’s app schema in scope, so every path they bind resolves an embedded leaf to its flattened storage column.