Struct inquire::MultiSelect [−][src]
pub struct MultiSelect<'a> { pub message: &'a str, pub options: &'a [&'a str], pub default: Option<&'a [usize]>, pub help_message: Option<&'a str>, pub page_size: usize, pub vim_mode: bool, pub starting_cursor: usize, pub filter: Filter<'a>, pub keep_filter: bool, pub formatter: MultiOptionFormatter<'a>, pub validator: Option<MultiOptionValidator<'a>>, }
Expand description
Selection of any amount of options from an interactive list.
Fields
message: &'a str
Message to be presented to the user.
options: &'a [&'a str]
Options displayed to the user.
default: Option<&'a [usize]>
Default indexes of options to be selected from the start.
help_message: Option<&'a str>
Help message to be presented to the user.
page_size: usize
Page size of the options displayed to the user.
vim_mode: bool
Whether vim mode is enabled. When enabled, the user can navigate through the options using hjkl.
starting_cursor: usize
Starting cursor index of the selection.
filter: Filter<'a>
Function called with the current user input to filter the provided options.
keep_filter: bool
Whether the current filter typed by the user is kept or cleaned after a selection is made.
formatter: MultiOptionFormatter<'a>
Function that formats the user input and presents it to the user as the final rendering of the prompt.
validator: Option<MultiOptionValidator<'a>>
Validator to apply to the user input.
In case of error, the message is displayed one line above the prompt.
Implementations
Default formatter, set to DEFAULT_MULTI_OPTION_FORMATTER
Default filter, equal to the global default filter config::DEFAULT_FILTER.
Default page size, equal to the global default page size config::DEFAULT_PAGE_SIZE
Default value of vim mode, equal to the global default value config::DEFAULT_PAGE_SIZE
Default starting cursor index.
Default behavior of keeping or cleaning the current filter value.
Default help message.
Default validator set for the MultiSelect prompt, none.
Creates a MultiSelect with the provided message and options, along with default configuration values.
Sets the help message of the prompt.
Removes the set help message.
Sets the page size.
Enables or disabled vim_mode.
Sets the keep filter behavior.
Sets the filter function.
Sets the formatter.
Sets the validator to apply to the user input. You might want to use this feature in case you need to limit the user to specific choices, such as limiting the number of selections.
In case of error, the message is displayed one line above the prompt.
Sets the indexes to be selected by the default.
Sets the starting cursor index.
Parses the provided behavioral and rendering options and prompts the CLI user for input according to the defined rules.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for MultiSelect<'a>
impl<'a> !Send for MultiSelect<'a>
impl<'a> !Sync for MultiSelect<'a>
impl<'a> Unpin for MultiSelect<'a>
impl<'a> !UnwindSafe for MultiSelect<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more