pub struct MenuOptions { /* private fields */ }Expand description
Controls and characters that can be configured to change the way the menu acts and displays
§Example
let options = MenuOptions::new()
.cursor("→")
.select_key(console::Key::Tab)
.max_lines_visible(6);
menu!("Only 6 lines are visible!",
menu_items_list,
options
)
Implementations§
Source§impl MenuOptions
impl MenuOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new MenuOptions with all the defaults
Sourcepub fn cursor(self, cursor: &str) -> Self
pub fn cursor(self, cursor: &str) -> Self
Set the user’s row-indicator/cursor to a custom character. The default is: ‘>’
Sourcepub fn cursor_width(self, cursor_width: usize) -> Self
pub fn cursor_width(self, cursor_width: usize) -> Self
Override the space given for the cursor navigation column
Sourcepub fn selected_indicator(self, indicator: &str) -> Self
pub fn selected_indicator(self, indicator: &str) -> Self
Set the “Item Selected” indicator to a custom character. Defaults is: ‘X’
Sourcepub fn selected_indicator_width(self, indicator_width: usize) -> Self
pub fn selected_indicator_width(self, indicator_width: usize) -> Self
Override the space given for the cursor navigation column
Sourcepub fn select_key(self, key: Key) -> Self
pub fn select_key(self, key: Key) -> Self
Set the key that is used to select an item.
The default is: [console::Key::Char(' ')]
Sourcepub fn max_lines_visible(self, max_lines: usize) -> Self
pub fn max_lines_visible(self, max_lines: usize) -> Self
Set the maximum number of items that will be displayed at any one time. The default is: 10
Sourcepub fn minimum_search_threshold(self, threshold: f32) -> Self
pub fn minimum_search_threshold(self, threshold: f32) -> Self
Set the degree of “fuzziness” that it will match too. Higher numbers will return more results, but less accurate ones. Has to be 1.0 >= x >= 0 or will panic The default is: 0.005
Sourcepub fn show_selected_in_search(self, show_in_search: bool) -> Self
pub fn show_selected_in_search(self, show_in_search: bool) -> Self
Set if ‘selected’ rows are still shown during searches they aren’t results for The default is: true
Sourcepub fn only_one_selection(self, only_one: bool) -> Self
pub fn only_one_selection(self, only_one: bool) -> Self
Set if the menu should exit and return only the first user selection. The default is: false
Sourcepub fn clear_on_close(self, do_clear: bool) -> Self
pub fn clear_on_close(self, do_clear: bool) -> Self
Set if the menu should delete any left-over lines from the terminal. The default is: true
Trait Implementations§
Source§impl Clone for MenuOptions
impl Clone for MenuOptions
Source§fn clone(&self) -> MenuOptions
fn clone(&self) -> MenuOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more