pub struct Select<T> { /* private fields */ }Expand description
A field that selects one value from a non-empty list of options.
Implementations§
Source§impl<T> Select<T>
impl<T> Select<T>
Sourcepub fn new(
key: FieldKey<T>,
question: impl Into<String>,
options: Vec<SelectOption<T>>,
) -> Result<Self, FieldConfigError>
pub fn new( key: FieldKey<T>, question: impl Into<String>, options: Vec<SelectOption<T>>, ) -> Result<Self, FieldConfigError>
Creates a select field with the first option initially selected.
Sourcepub fn help(self, help: impl Into<String>) -> Self
pub fn help(self, help: impl Into<String>) -> Self
Sets the navigation hint shown beneath the options.
help is plain text. Escape sequences in it are counted as ordinary
characters when the prompt measures its cells, so a pre-styled string
mis-aligns the field; style it through the prompt’s theme instead.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets supporting text shown below the question.
description is plain text. Escape sequences in it are counted as ordinary
characters when the prompt measures its cells, so a pre-styled string
mis-aligns the field; style it through the prompt’s theme instead.
Sourcepub fn filter_help(
self,
editing: impl Into<String>,
applied: impl Into<String>,
) -> Self
pub fn filter_help( self, editing: impl Into<String>, applied: impl Into<String>, ) -> Self
Sets the hints shown while editing and after applying a filter.
Sourcepub fn no_matches_message(self, message: impl Into<String>) -> Self
pub fn no_matches_message(self, message: impl Into<String>) -> Self
Sets the message shown when filtering removes every option.
Sourcepub fn visible_rows(self, rows: usize) -> Self
pub fn visible_rows(self, rows: usize) -> Self
Limits the number of option rows shown before the list scrolls.