Skip to main content

Field

Struct Field 

Source
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: String

Help shown under it (the descriptor’s description otherwise).

§restart: bool

A change takes effect after a restart.

§hooks: FieldHooks

Hooks by name (hooks).

§input: Input

A 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

Source

pub fn setting(id: &str) -> Field

A field bound to a declared setting; its id is the setting’s.

Source

pub fn draft(task: &str, key: &str, title: &str, kind: FieldKind) -> Field

A field of a task’s draft.

Source

pub fn kind(self, kind: FieldKind) -> Field

Source

pub fn scopes(self, scopes: &[ValueScope]) -> Field

Source

pub fn help(self, help: &str) -> Field

Source

pub fn restart(self) -> Field

Source

pub fn validate(self, hook: &str) -> Field

Source

pub fn choices(self, hook: &str) -> Field

Source

pub fn preview(self, hook: &str) -> Field

Source

pub fn transform(self, hook: &str) -> Field

Source

pub fn default_value(self, value: Value) -> Field

A draft field’s value at the start.

Source

pub fn choice(self, value: Value, label: &str) -> Field

A draft field’s choice: the value kept and its label.

Source

pub fn range(self, min: f64, max: f64) -> Field

A draft number’s range.

Source

pub fn open_file(self, extensions: &[&str]) -> Field

A draft path field whose Browse chooses a file to read.

Source

pub fn open_folder(self) -> Field

A draft path field whose Browse chooses a folder.

Source

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.

Source

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.

Source

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.

Source

pub fn save_file(self, name: &str, extensions: &[&str]) -> Field

A draft path field whose Browse chooses a file to write, name proposed.

Source

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.

Source

pub fn icon(self, name: &str) -> Field

With an icon by registry name (a note draws it before its words).

Source

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.

Source

pub fn required(self) -> Field

Source

pub fn draft_key(&self) -> Option<&str>

The draft key it is bound to, if any.

Source

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.

Source

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).

Source

pub fn setting_id(&self) -> Option<&str>

The setting it is bound to, if any.

Trait Implementations§

Source§

impl Clauses for Field

Source§

fn meta_mut(&mut self) -> &mut Meta

Source§

fn when(self, clause: &str) -> Self

Shown only when the clause holds (the when language; the section’s values as form.<field id>).
Source§

fn enabled(self, clause: &str, reason: &str) -> Self

Greyed, with its reason, when the clause does not hold.
Source§

impl Clone for Field

Source§

fn clone(&self) -> Field

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Field

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Field

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Field, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Field

Source§

fn eq(&self, other: &Field) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Field

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,