pub struct FormTemplate {
pub kind: String,
pub key_prefix: Option<String>,
pub fields: Vec<FieldTemplate>,
pub buttons: Vec<Map<String, Value>>,
pub action: Option<Map<String, Value>>,
pub description: Option<Value>,
}Expand description
A JSON-serializable form structure without record data.
Reading one from JSON accepts exactly the shape compile_form produces; see
FormTemplate::from_json.
Fields§
§kind: StringTemplate format identifier.
key_prefix: Option<String>Optional root prefix for input names.
fields: Vec<FieldTemplate>Top-level field definitions.
Form buttons in declaration order; one submit button when the spec declares none.
action: Option<Map<String, Value>>Submission target declared by the spec, kept unchanged in the template.
description: Option<Value>Root description content as declared by the spec (any value, null included), translated
when the form is rendered; None when the root declares no description.
Implementations§
Source§impl FormTemplate
impl FormTemplate
Sourcepub fn from_json(value: &Value) -> FormResult<FormTemplate>
pub fn from_json(value: &Value) -> FormResult<FormTemplate>
Read a template that is exactly what compile_form produces: an object whose only
members are kind (crudui/form-template), fields, buttons (objects), an optional
string keyPrefix, an optional object action and an optional description of any
value; each field has exactly a string
name, an object spec and a field list children. Any other value fails with
Unsupported form template.
Trait Implementations§
Source§impl Clone for FormTemplate
impl Clone for FormTemplate
Source§fn clone(&self) -> FormTemplate
fn clone(&self) -> FormTemplate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more