Skip to main content

Module auto_form

Module auto_form 

Source
Expand description

Auto form generation — derive a FormConfig from a Rust type that implements FormModel, no manual field-by-field wiring.

Callers describe their model once (as a Vec<AutoField> in form_fields), and form_from_model or the fluent FormBuilder produce the same FormConfig the manual engine consumes. The existing crate::admin::form renderer is untouched — this module is purely additive.

No macros, no runtime reflection, no DB introspection. Pure typed metadata supplied by the caller.

Structs§

AutoField
Declarative description of one field on a model. The caller fills this in once per column; the converter turns it into a FieldConfig.
FieldOverride
Patch applied to a single field after auto-generation. Every sub-field is OptionNone means “leave as the generated value”.
FormBuilder
Fluent builder that starts from an auto-generated FormConfig and lets the caller patch individual fields. An override_field(name, ...) call whose name doesn’t match any generated field is a silent no-op — the builder intentionally doesn’t fail on typos so it composes with optional overrides from config files.

Traits§

FormModel
Types that can describe their own form shape.

Functions§

form_from_model
Build a FormConfig from a model’s FormModel impl. The resulting form has no values and no help — overrides populate those via FormBuilder::override_field.