fuzzy_select_with_key_with_default

Function fuzzy_select_with_key_with_default 

Source
pub fn fuzzy_select_with_key_with_default<T>(
    items: &[T],
    prompt: impl AsRef<str>,
    f_display: impl Fn(&T) -> String,
    default_index: Option<usize>,
) -> Result<&T>
Expand description

Given a list of items, this function allows the user to interactively select a exactly one item of the given list.

  • To guide the user, you have to provide a prompt
  • Some types are not natively displayable. In these cases you can decide what to show to the user for each item with f_display
  • The default_index optional index value can pre-select one item