Type Definition inquire::formatter::CustomTypeFormatter
source · Expand description
Type alias for formatters used in CustomType
prompts.
Formatters receive the user input and return a String to be displayed to the user as the final answer.
Examples
use inquire::CustomType;
use inquire::formatter::CustomTypeFormatter;
let formatter: CustomTypeFormatter<f64> = &|i| format!("${:.2}", i);
assert_eq!(String::from("$12.33"), formatter(12.33));
assert_eq!(String::from("$44.91"), formatter(44.9123));
assert_eq!(String::from("$45.00"), formatter(44.998));