pub struct Select<T: Clone + PartialEq + Send + Sync + 'static> { /* private fields */ }Expand description
A select field for choosing one option from a list.
Implementations§
Source§impl<T: Clone + PartialEq + Send + Sync + Default + 'static> Select<T>
impl<T: Clone + PartialEq + Send + Sync + Default + 'static> Select<T>
Sourcepub fn options(self, options: Vec<SelectOption<T>>) -> Self
pub fn options(self, options: Vec<SelectOption<T>>) -> Self
Sets the options.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets the description.
Sourcepub fn validate(self, validate: fn(&T) -> Option<String>) -> Self
pub fn validate(self, validate: fn(&T) -> Option<String>) -> Self
Sets the validation function.
Sourcepub fn height_options(self, height: usize) -> Self
pub fn height_options(self, height: usize) -> Self
Sets the visible height (number of options shown).
Sourcepub fn filterable(self, enabled: bool) -> Self
pub fn filterable(self, enabled: bool) -> Self
Enables or disables type-to-filter support.
When filtering is enabled, typing characters will filter the visible options. Navigation keys (j/k/g/G) still work for movement. Press Escape to clear the filter, Backspace to delete the last character.
Sourcepub fn get_selected_value(&self) -> Option<&T>
pub fn get_selected_value(&self) -> Option<&T>
Gets the currently selected value.
Trait Implementations§
Source§impl<T: Clone + PartialEq + Send + Sync + Default + 'static> Field for Select<T>
impl<T: Clone + PartialEq + Send + Sync + Default + 'static> Field for Select<T>
Source§fn with_theme(&mut self, theme: &Theme)
fn with_theme(&mut self, theme: &Theme)
Sets the theme.
Source§fn with_keymap(&mut self, keymap: &KeyMap)
fn with_keymap(&mut self, keymap: &KeyMap)
Sets the keymap.
Source§fn with_width(&mut self, width: usize)
fn with_width(&mut self, width: usize)
Sets the width.
Source§fn with_height(&mut self, height: usize)
fn with_height(&mut self, height: usize)
Sets the height.
Source§fn with_position(&mut self, position: FieldPosition)
fn with_position(&mut self, position: FieldPosition)
Sets the field position.
Auto Trait Implementations§
impl<T> Freeze for Select<T>
impl<T> !RefUnwindSafe for Select<T>
impl<T> Send for Select<T>
impl<T> Sync for Select<T>
impl<T> Unpin for Select<T>where
T: Unpin,
impl<T> !UnwindSafe for Select<T>
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