Constant inquire::formatter::DEFAULT_MULTI_OPTION_FORMATTER[][src]

pub const DEFAULT_MULTI_OPTION_FORMATTER: MultiOptionFormatter<'_>;
Expand description

String formatter used by default in MultiSelect prompts. Prints the string value of all selected options, separated by commas.

Examples

use inquire::option_answer::OptionAnswer;
use inquire::formatter::DEFAULT_MULTI_OPTION_FORMATTER;

let formatter = DEFAULT_MULTI_OPTION_FORMATTER;

let mut ans = vec![OptionAnswer::new(0, "New York")];
assert_eq!(String::from("New York"), formatter(&ans));

ans.push(OptionAnswer::new(3, "Seattle"));
assert_eq!(String::from("New York, Seattle"), formatter(&ans));

ans.push(OptionAnswer::new(7, "Vancouver"));
assert_eq!(String::from("New York, Seattle, Vancouver"), formatter(&ans));