#[non_exhaustive]pub struct SelectField {
pub name: String,
pub label: String,
pub multiple: bool,
pub options: Vec<String>,
pub placeholder: String,
pub prerequisites: Vec<String>,
pub required: bool,
pub supports_suggestions: bool,
}Expand description
Defines a field that allows selection from a predefined list of options.
Values to be selected from can be either hard-coded in the schema, or (only for query forms) fetched on-demand the same way as auto-suggestions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringName of the field as it will be included in the encoded query or config object.
label: StringSuggested label to display along the field.
multiple: boolWhether multiple values may be selected.
options: Vec<String>A list of options to select from.
In addition to the options in this list, the auto-suggest mechanism
can also fetch options when the user starts typing in this field. In
this case, supports_suggestions should be set to true.
placeholder: StringSuggested placeholder to display when there is no value.
prerequisites: Vec<String>An optional list of fields that should be filled in before allowing the user to fill in this field. This forces a certain ordering in the data entry, which enables richer auto-suggestions, since the filled in prerequisite fields can provide additional context.
required: boolWhether a value is required.
supports_suggestions: boolWhether the provider supports auto-suggestions for this field.
Implementations§
Source§impl SelectField
impl SelectField
pub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_name(self, name: impl Into<String>) -> Self
pub fn with_options(self, options: impl Into<Vec<String>>) -> Self
pub fn with_placeholder(self, placeholder: impl Into<String>) -> Self
pub fn with_prerequisites(self, prerequisites: impl Into<Vec<String>>) -> Self
Sourcepub fn with_suggestions(self) -> Self
pub fn with_suggestions(self) -> Self
Marks the field as supporting auto-suggestions.
Trait Implementations§
Source§impl Clone for SelectField
impl Clone for SelectField
Source§fn clone(&self) -> SelectField
fn clone(&self) -> SelectField
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more