pub type BoolFormatter<'a> = &'a dyn Fn(bool) -> String;
Expand description

Type alias for formatters used in Confirm prompts.

Formatters receive the user input and return a String to be displayed to the user as the final answer.

Examples

use inquire::formatter::BoolFormatter;

let formatter: BoolFormatter = &|i| match i {
    true => String::from("si"),
    false => String::from("no"),
};
assert_eq!(String::from("si"), formatter(true));
assert_eq!(String::from("no"), formatter(false));