Skip to main content

EditForm

Struct EditForm 

Source
pub struct EditForm<'a, A, T = ()> {
    pub form: Form,
    /* private fields */
}
Expand description

A Form and what setting each of its fields does, for the arguments A and the session T.

Fields§

§form: Form

Implementations§

Source§

impl<'a, A, T> EditForm<'a, A, T>

Source

pub fn into_form(self) -> Form

The form, as an editor is shown it.

Source

pub fn set(&self, key: &str, edit: Edit<'_, A, T>, value: Value)

What the field key does with value: its setter’s. Nothing for a key no field has — a field shown only to be read.

Source

pub fn on( &mut self, key: impl Into<String>, setter: impl Fn(Edit<'_, A, T>, Value) + 'a, )

setter for the key key: for a control already in the dialog, or one of its items — a list’s entries each have their own key.

Source

pub fn layout(&mut self, layout: Layout) -> &mut Self

Shown as layout says (see Layout).

Source

pub fn input( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, placeholder: Option<&str>, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self

Text typed — a name, a title — set to what is typed (see crate::editing::Dialog::input).

Source

pub fn table( &mut self, key: &str, table: Table, edit: impl Fn(Edit<'_, A, T>, TableEdit) + 'a, ) -> &mut Self

A table edited in place (see Table): edit is run for each thing done to it. A block pasted is taken apart here, into a row added for each line below the last and the cells set, in reading order — so edit never sees a TableEdit::Paste, and a cell set in a row just added finds the row there.

Source

pub fn actions( &mut self, key: &str, actions: Vec<Action>, run: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self

Things to do or choose; pressing one runs run with its value.

Source

pub fn checkbox( &mut self, key: &str, label: impl Into<String>, value: bool, set: impl Fn(Edit<'_, A, T>, bool) + 'a, ) -> &mut Self

Source

pub fn number( &mut self, key: &str, number: Number, set: impl Fn(Edit<'_, A, T>, f64) + 'a, ) -> &mut Self

Source

pub fn numeric( &mut self, key: &str, number: Number, set: impl Fn(Edit<'_, A, T>, NumericInput) + 'a, ) -> &mut Self

A number field of a NumericInput (see Number::numeric): text typed sets it — plain if it is a number, a formula otherwise — and a number slid or dragged sets it plain. A formula that does not evaluate is kept, as typed, its field saying why: the step then fails naming it, and the text is there to be corrected.

Source

pub fn select( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, options: Vec<Choice>, searchable: bool, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self

One of options, by value — found by typing, if searchable.

Source

pub fn file( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, files: Vec<FileEntry>, upload: &[&str], set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self

A file the program reads or places (see crate::editing::Dialog::file).

Source

pub fn color( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, set: impl Fn(Edit<'_, A, T>, &str) + 'a, ) -> &mut Self

A colour, #rrggbb.

Source

pub fn pick<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'a>, value: &[P], multiple: bool, set: impl Fn(Edit<'_, A, T>, Vec<P>) + 'a, ) -> &mut Self

Values picked, holding value, each selected by a click as P says in the part reader reads (see Selectable): set gets what the field holds after a pick — the values held, and the one a click selected, or without the one it took out.

Source

pub fn pick_one<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'a>, value: Option<&P>, set: impl Fn(Edit<'_, A, T>, P) + 'a, ) -> &mut Self

One value picked, holding value if there is one (see EditForm::pick): set gets the value a click picks. Emptying the field sets nothing: what a step needs one of is never none.

Trait Implementations§

Source§

impl<A, T> Default for EditForm<'_, A, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, A, T = ()> !RefUnwindSafe for EditForm<'a, A, T>

§

impl<'a, A, T = ()> !Send for EditForm<'a, A, T>

§

impl<'a, A, T = ()> !Sync for EditForm<'a, A, T>

§

impl<'a, A, T = ()> !UnwindSafe for EditForm<'a, A, T>

§

impl<'a, A, T> Freeze for EditForm<'a, A, T>

§

impl<'a, A, T> Unpin for EditForm<'a, A, T>

§

impl<'a, A, T> UnsafeUnpin for EditForm<'a, A, T>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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