[][src]Struct dialoguer::Confirm

pub struct Confirm<'a> { /* fields omitted */ }

Renders a confirm prompt.

Example usage

use dialoguer::Confirm;

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

Methods

impl<'a> Confirm<'a>[src]

pub fn new() -> Confirm<'static>[src]

Creates a confirm prompt.

pub fn with_theme(theme: &'a dyn Theme) -> Confirm<'a>[src]

Creates a confirm prompt with a specific theme.

pub fn with_prompt<S: Into<String>>(&mut self, prompt: S) -> &mut Confirm<'a>[src]

Sets the confirm prompt.

pub fn with_text(&mut self, text: &str) -> &mut Confirm<'a>[src]

Deprecated since 0.6.0:

Use with_prompt() instead

pub fn default(&mut self, val: bool) -> &mut Confirm<'a>[src]

Overrides the default.

pub fn show_default(&mut self, val: bool) -> &mut Confirm<'a>[src]

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.

pub fn interact(&self) -> Result<bool>[src]

Enables user interaction and returns the result.

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

pub fn interact_on(&self, term: &Term) -> Result<bool>[src]

Like interact but allows a specific terminal to be set.

Trait Implementations

impl<'a> Default for Confirm<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Confirm<'a>

impl<'a> !Send for Confirm<'a>

impl<'a> !Sync for Confirm<'a>

impl<'a> Unpin for Confirm<'a>

impl<'a> !UnwindSafe for Confirm<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,