multi_fuzzy_select_with_key

Function multi_fuzzy_select_with_key 

Source
pub fn multi_fuzzy_select_with_key<T>(
    items: &[T],
    prompt: impl AsRef<str>,
    is_selected: impl Fn(&T) -> bool,
    f_display: impl Fn(&T) -> String,
) -> Result<Vec<&T>>
Expand description

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

  • To guide the user, you have to provide a prompt
  • The is_selected closure can help to preselect a certain set of items that pass the predicate
  • Some types are not natively displayable. In these cases you can decide what to show to the user for each item with f_display