Type Alias inquire::formatter::StringFormatter

source ·
pub type StringFormatter<'a> = &'a dyn Fn(&str) -> String;
Expand description

Type alias for formatters that receive a string slice as the input, required by Text and Password for example.

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

§Examples

use inquire::formatter::StringFormatter;

let formatter: StringFormatter = &|i| i.to_lowercase();
assert_eq!(String::from("times square"), formatter("Times Square"));
assert_eq!(String::from("times square"), formatter("times square"));