[−][src]Struct dialoguer::Confirmation
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 :("); }
Methods
impl<'a> Confirmation<'a>
[src]
pub fn new() -> Confirmation<'static>
[src]
Creates the prompt with a specific text.
pub fn with_theme(theme: &'a dyn Theme) -> Confirmation<'a>
[src]
Sets a theme other than the default one.
pub fn with_text(&mut self, text: &str) -> &mut Confirmation<'a>
[src]
Sets the confirmation text.
pub fn default(&mut self, val: bool) -> &mut Confirmation<'a>
[src]
Overrides the default.
pub fn show_default(&mut self, val: bool) -> &mut Confirmation<'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.
Auto Trait Implementations
impl<'a> !Send for Confirmation<'a>
impl<'a> !Sync for Confirmation<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,