Struct inquire::Confirm [−][src]
pub struct Confirm<'a> { pub message: &'a str, pub default: Option<bool>, pub help_message: Option<&'a str>, pub formatter: fn(answer: bool) -> &'a str, pub parser: fn(answer: &str) -> Result<bool, String>, pub default_value_formatter: fn(answer: bool) -> &'a str, }
Expand description
Presents a message to the user and asks them for a yes/no confirmation.
Fields
message: &'a str
Message to be presented to the user.
default: Option<bool>
Default value, returned when the user input is empty.
help_message: Option<&'a str>
Help message to be presented to the user.
formatter: fn(answer: bool) -> &'a str
Function that formats the user input and presents it to the user as the final rendering of the prompt.
parser: fn(answer: &str) -> Result<bool, String>
Function that parses the user input and returns the result
default_value_formatter: fn(answer: bool) -> &'a str
Function that formats the default value to be presented to the user
Implementations
Creates a Confirm with the provided message and default configuration values.
Sets the default input.
Sets the help message of the prompt.
Sets the formatter
Sets the parser
Sets the default value formatter
Parses the provided behavioral and rendering options and prompts the CLI user for input according to them.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Confirm<'a>
impl<'a> UnwindSafe for Confirm<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more