#[non_exhaustive]pub enum Input {
Number {
label: Option<String>,
initial_value: f64,
min: Option<f64>,
max: Option<f64>,
},
Slider {
label: Option<String>,
min: f64,
max: f64,
step: f64,
initial_value: f64,
},
Dropdown {
label: Option<String>,
options: Vec<Choice>,
initial_value: usize,
},
Text {
label: Option<String>,
initial_value: String,
multiline: bool,
max_length: usize,
},
Checkbox {
label: Option<String>,
initial_value: bool,
},
MultiSelect {
label: Option<String>,
options: Vec<Choice>,
initial_values: Vec<usize>,
},
Image {
label: Option<String>,
},
Table {
label: Option<String>,
},
Described {
input: Box<Input>,
unit: Option<String>,
help: Option<String>,
},
}Expand description
An input component definition. All fields are required in submitted forms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Number
A numerical textbox with optional inclusive bounds.
Fields
Slider
A bounded numerical slider.
Fields
Dropdown
A dropdown whose options may carry numerical or text values.
Fields
Text
A single- or multiple-line text input.
Fields
Checkbox
A boolean checkbox.
MultiSelect
A list of independently selectable labeled values.
Fields
Image
Select a local PNG or JPEG, up to 8 MiB and 4096×4096 pixels.
Table
Import a UTF-8 CSV with a header and up to 1,000 data rows.
Described
Presentation metadata around an input; use with_unit and with_help.
Implementations§
Source§impl Input
impl Input
Sourcepub fn number(label: impl Into<String>, initial_value: f64) -> Self
pub fn number(label: impl Into<String>, initial_value: f64) -> Self
Create an unbounded numerical textbox with a label.
Sourcepub fn text(
label: impl Into<String>,
initial_value: impl Into<String>,
multiline: bool,
) -> Self
pub fn text( label: impl Into<String>, initial_value: impl Into<String>, multiline: bool, ) -> Self
Create a text input with a 4,096-character limit.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
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
Mutably borrows from an owned value. Read more