Skip to main content

Dialog

Struct Dialog 

Source
pub struct Dialog(pub Vec<Field>);
Expand description

The fields an operation shows for a step, in order: an ordered dictionary from key to control, serialized as a list, so a UI renders it with one map and keys each element by it. Keys are unique.

Tuple Fields§

§0: Vec<Field>

Implementations§

Source§

impl Dialog

Source

pub fn new() -> Self

Source

pub fn push(&mut self, key: impl Into<String>, control: Control) -> &mut Self

Appends control under key.

Source

pub fn heading(&mut self, key: &str, text: impl Into<String>) -> &mut Self

Source

pub fn text( &mut self, key: &str, text: impl Into<String>, tone: Tone, ) -> &mut Self

Source

pub fn input( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, placeholder: Option<&str>, ) -> &mut Self

Text typed: a name, a title (see Control::Input).

Source

pub fn table(&mut self, key: &str, table: Table) -> &mut Self

A table edited in place (see Table).

Source

pub fn list( &mut self, key: &str, items: Vec<ListItem>, empty: impl Into<String>, ) -> &mut Self

A list of entries, each with a key of its own.

Source

pub fn download( &mut self, key: &str, exporter: &str, formats: Vec<Choice>, ) -> &mut Self

Files the step can be saved as by the exporter exporter, one button per format in formats (see Control::Download).

Source

pub fn actions(&mut self, key: &str, actions: Vec<Action>) -> &mut Self

Things to do or choose: pressing one sends its value as super::Value::Choice.

Source

pub fn checkbox( &mut self, key: &str, label: impl Into<String>, value: bool, ) -> &mut Self

Source

pub fn number(&mut self, key: &str, number: Number) -> &mut Self

Source

pub fn select( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, options: Vec<Choice>, searchable: bool, ) -> &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], ) -> &mut Self

A file the program reads or places, by its path relative to the program: one of files it takes, or one the user adds from elsewhere of the kinds upload, extensions without the dot (see Control::File).

Source

pub fn color( &mut self, key: &str, label: impl Into<String>, value: impl Into<String>, ) -> &mut Self

A colour, #rrggbb.

Source

pub fn pick<P: Selectable>( &mut self, key: &str, label: impl Into<String>, reader: &Reader<'_>, value: &[P], multiple: bool, ) -> &mut Self

Values picked, holding value, each selected by a click as P says (see Selectable) in the part reader reads. What a field so made is sent back, crate::selectable::selected turns into values. Required: see Dialog::optional.

Source

pub fn reference( &mut self, key: &str, label: impl Into<String>, value: Vec<Picked>, accepts: &[&str], multiple: bool, preview: Preview, ) -> &mut Self

Elements of the kinds accepts (see Reference), holding value, what a click would pick drawn as preview says. Required: see Dialog::optional.

Source

pub fn optional(&mut self, key: &str) -> &mut Self

Makes the reference field key optional: the step builds without it, and it is only picked for when pressed (see Reference::required).

Source

pub fn get(&self, key: &str) -> Option<&Control>

The field key.

Source

pub fn references(&self) -> impl Iterator<Item = (&str, &Reference)>

Every reference field, by key.

Source

pub fn references_mut(&mut self) -> impl Iterator<Item = (&str, &mut Reference)>

Every reference field, by key, to change.

Source

pub fn previewed( &self, reader: &Reader<'_>, key: &str, element: &PickedElement, ) -> Option<Picked>

What a click on element would pick for the reference field key, in the part reader reads: as it would be held, to light and draw while the pointer is over it (see Preview).

Source

pub fn shown(&self, hovered: Option<&Picked>) -> Vec<Visual>

What an editor draws of every value its reference fields hold besides lighting it (see Picked::visuals), drawn as selected — and of hovered, what a click would pick now, drawn as hovered.

Source

pub fn concerning(&mut self, key: &str, error: &str) -> bool

What an editor draws of every element its reference fields hold: what the step builds on, to light. Says error beside the field key, if it has one: whether it did.

Source

pub fn picked(&self) -> impl Iterator<Item = &PickedElement>

Source

pub fn missing(&self) -> Vec<&str>

The labels of its reference fields that hold nothing yet: what the step still needs picked before it can be built at all. Until then, that it does not build is no error — it is waiting.

Source

pub fn summary(&self) -> String

Its values in one line, for a list of steps: sketch=outline, distance=1.00.

Trait Implementations§

Source§

impl Clone for Dialog

Source§

fn clone(&self) -> Dialog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Dialog

Source§

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

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

impl Default for Dialog

Source§

fn default() -> Dialog

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

impl PartialEq for Dialog

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Dialog

Source§

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

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

impl StructuralPartialEq for Dialog

Auto Trait Implementations§

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