pub struct Field {
pub meta: Meta,
pub bind: Bind,
pub kind: Option<FieldKind>,
pub scopes: Vec<ValueScope>,
pub help: String,
pub restart: bool,
pub hooks: FieldHooks,
pub input: Input,
}Expand description
A value bound to the store or a draft.
Fields§
§meta: Meta§bind: Bind§kind: Option<FieldKind>None: from the descriptor’s type.
scopes: Vec<ValueScope>The host’s scopes its value may also be set for, above app
(opt-in); empty: app only, and no “Set for” choice.
help: StringHelp shown under it (the descriptor’s description otherwise).
restart: boolA change takes effect after a restart.
hooks: FieldHooksHooks by name (hooks).
input: InputA draft field’s own descriptor: its default, choices, range and whether it is required (a setting’s comes from its declaration).
Implementations§
Source§impl Field
impl Field
Sourcepub fn setting(id: &str) -> Field
pub fn setting(id: &str) -> Field
A field bound to a declared setting; its id is the setting’s.
Sourcepub fn draft(task: &str, key: &str, title: &str, kind: FieldKind) -> Field
pub fn draft(task: &str, key: &str, title: &str, kind: FieldKind) -> Field
A field of a task’s draft.
pub fn kind(self, kind: FieldKind) -> Field
pub fn scopes(self, scopes: &[ValueScope]) -> Field
pub fn help(self, help: &str) -> Field
pub fn restart(self) -> Field
pub fn validate(self, hook: &str) -> Field
pub fn choices(self, hook: &str) -> Field
pub fn preview(self, hook: &str) -> Field
pub fn transform(self, hook: &str) -> Field
Sourcepub fn default_value(self, value: Json) -> Field
pub fn default_value(self, value: Json) -> Field
A draft field’s value at the start.
Sourcepub fn choice(self, value: Json, label: &str) -> Field
pub fn choice(self, value: Json, label: &str) -> Field
A draft field’s choice: the value kept and its label.
Sourcepub fn open_file(self, extensions: &[&str]) -> Field
pub fn open_file(self, extensions: &[&str]) -> Field
A draft path field whose Browse chooses a file to read.
Sourcepub fn open_folder(self) -> Field
pub fn open_folder(self) -> Field
A draft path field whose Browse chooses a folder.
Sourcepub fn dialog_title(self, title: &str) -> Field
pub fn dialog_title(self, title: &str) -> Field
A path field’s chooser title, a task (“Choose an enrolment file”)
rather than the field’s title. After Field::open_file,
Field::save_file or Field::open_folder; nothing before.
Sourcepub fn dialog_purpose(self, key: &str) -> Field
pub fn dialog_purpose(self, key: &str) -> Field
The key a path field’s chooser remembers its last folder under
(default egui_pop.admin.<draft key>). After Field::open_file,
Field::save_file or Field::open_folder; nothing before.
Sourcepub fn filter_name(self, name: &str) -> Field
pub fn filter_name(self, name: &str) -> Field
What a path field’s chooser calls its extensions’ filter
(“Enrolment files”; default: the extensions joined). After
Field::open_file or Field::save_file; nothing before.
Sourcepub fn save_file(self, name: &str, extensions: &[&str]) -> Field
pub fn save_file(self, name: &str, extensions: &[&str]) -> Field
A draft path field whose Browse chooses a file to write, name
proposed.
Sourcepub fn note(task: &str, key: &str, text: &str) -> Field
pub fn note(task: &str, key: &str, text: &str) -> Field
A draft field that may not be left empty.
A read-only line of a task’s draft (FieldKind::Note): text
is its draft’s starting value, which the host may set again
(a count read once the form is open); an empty value shows the
title.
Sourcepub fn icon(self, name: &str) -> Field
pub fn icon(self, name: &str) -> Field
With an icon by registry name (a note draws it before its words).
Sourcepub fn note_text(&self, value: &Json) -> String
pub fn note_text(&self, value: &Json) -> String
A note’s words for its draft value: the value written out when it says something, else its title.
pub fn required(self) -> Field
Sourcepub fn check(&self, value: &Json) -> Option<Check>
pub fn check(&self, value: &Json) -> Option<Check>
What its input says of a value: empty when required, out of its
range, not one of its choices. None: fine.
Sourcepub fn shown(&self, value: &Json) -> String
pub fn shown(&self, value: &Json) -> String
A value as the summary shows it: its choice’s label, else written out (a toggle’s words are the shell’s).
Sourcepub fn setting_id(&self) -> Option<&str>
pub fn setting_id(&self) -> Option<&str>
The setting it is bound to, if any.