Struct inquire::Select[][src]

pub struct Select<'a> {
    pub message: &'a str,
    pub options: &'a [&'a str],
    pub help_message: Option<&'a str>,
    pub page_size: usize,
    pub vim_mode: bool,
    pub starting_cursor: usize,
    pub filter: Filter,
    pub formatter: fn(answer: &OptionAnswer) -> String,
}
Expand description

Presents a message to the user and a list of options for the user to choose from. The user is able to choose only one option.

Fields

message: &'a str

Message to be presented to the user.

options: &'a [&'a str]

Options displayed to the user.

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

Function called with the current user input to filter the provided options.

formatter: fn(answer: &OptionAnswer) -> String

Function that formats the user input and presents it to the user as the final rendering of the prompt.

Implementations

Default formatter.

Default filter.

Default page size.

Default value of vim mode.

Default starting cursor index.

Default help message.

Creates a Select 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 filter function.

Sets the formatter.

Sets the starting cursor index.

Parses the provided behavioral and rendering options and prompts the CLI user for input according to them.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.