pub struct StepField {
pub id: String,
pub label: String,
pub required: bool,
pub hint: String,
pub kind: FieldKind,
}Expand description
One field of a step.
Fields§
§id: StringMF12: unique in the document, never reused.
label: StringWhat the field asks for (Bearing seated, Shaft diameter).
required: boolThe step is not complete until the field is filled (a check: ticked).
hint: StringA line of help shown with the field.
kind: FieldKindImplementations§
Source§impl StepField
impl StepField
Sourcepub fn new(id: String, key: &str, label: &str) -> Option<Self>
pub fn new(id: String, key: &str, label: &str) -> Option<Self>
A new field of kind key (see FieldKind::new) labelled label.
Sourcepub fn from_json(value: &Value) -> Result<Self, String>
pub fn from_json(value: &Value) -> Result<Self, String>
Read a field from JSON ({label, kind, …}), refusing a key no field
has. A choice given without options, like any kind given bare, takes
the kind’s defaults.
Sourcepub fn patched(&self, patch: &Value) -> Result<Self, String>
pub fn patched(&self, patch: &Value) -> Result<Self, String>
The field with patch’s keys set (null clears an optional one).
Changing kind drops what belonged to the old kind and takes the new
kind’s defaults; the id never changes.
Sourcepub fn options(&self) -> Vec<&str>
pub fn options(&self) -> Vec<&str>
The options a choice offers, as shown: blank ones left out and a repeated one listed once. Empty for every other kind.
Sourcepub fn limits_text(&self) -> String
pub fn limits_text(&self) -> String
A measurement’s nominal and limits as the page and the paper print
them: 10.00 mm, 9.95–10.05, min 2.0 N·m, max 5; empty when the
field has none (or is no measurement). Only characters every output
can draw (the PDF’s base font has no ≥ or ≤).