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: Value) -> Field
pub fn default_value(self, value: Value) -> Field
A draft field’s value at the start.
Sourcepub fn choice(self, value: Value, label: &str) -> Field
pub fn choice(self, value: Value, 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: &Value) -> String
pub fn note_text(&self, value: &Value) -> 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: &Value) -> Option<Check>
pub fn check(&self, value: &Value) -> 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: &Value) -> String
pub fn shown(&self, value: &Value) -> 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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Field
impl<'de> Deserialize<'de> for Field
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Field, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Field, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Field
impl Serialize for Field
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more