Struct dialoguer::Confirmation

source ·
pub struct Confirmation<'a> { /* private fields */ }
Expand description

Renders a simple confirmation prompt.

Example usage

use dialoguer::Confirmation;

if Confirmation::new().with_text("Do you want to continue?").interact()? {
    println!("Looks like you want to continue");
} else {
    println!("nevermind then :(");
}

Implementations

Creates the prompt with a specific text.

Sets a theme other than the default one.

Sets the confirmation text.

Overrides the default.

Disables or enables the default value display.

The default is to append [y/n] to the prompt to tell the user which keys to press. This also renders the default choice in uppercase. The default is selected on enter.

Enables user interaction and returns the result.

If the user confirms the result is true, false otherwise. The dialog is rendered on stderr.

Like interact but allows a specific terminal to be set.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.