[][src]Struct ahum_dialoguer::PasswordInput

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

Renders a password input prompt.

Example usage

use ahum_dialoguer::PasswordInput;

let password = PasswordInput::new().with_prompt("New Password")
    .with_confirmation("Confirm password", "Passwords mismatching")
    .interact()?;
println!("Length of the password is: {}", password.len());

Methods

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

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

Creates a new input prompt.

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

Creates the password input with a specific theme.

pub fn with_prompt(&mut self, prompt: &str) -> &mut PasswordInput<'a>[src]

Sets the prompt.

pub fn with_confirmation(
    &mut self,
    prompt: &str,
    mismatch_err: &str
) -> &mut PasswordInput<'a>
[src]

Enables confirmation prompting.

pub fn allow_empty_password(
    &mut self,
    allow_empty_password: bool
) -> &mut PasswordInput<'a>
[src]

Allows/Disables empty password.

By default this setting is set to false (i.e. password is not empty).

pub fn interact(&self) -> Result<String>[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<String>[src]

Like interact but allows a specific terminal to be set.

Auto Trait Implementations

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

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

Blanket Implementations

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

impl<T> From<T> for 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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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