[][src]Struct termprompt::Password

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

Renders a password input prompt.

Example usage

use dialoguer::Password;

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

Implementations

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

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

Creates a password input prompt.

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

Creates a password input prompt with a specific theme.

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

Sets the password input prompt.

pub fn with_confirmation<A, B>(
    &mut self,
    prompt: A,
    mismatch_err: B
) -> &mut Password<'a> where
    A: Into<String>,
    B: Into<String>, 
[src]

Enables confirmation prompting.

pub fn allow_empty_password(
    &mut self,
    allow_empty_password: bool
) -> &mut Password<'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.

Trait Implementations

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

Auto Trait Implementations

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

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

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

impl<'a> Unpin for Password<'a>

impl<'a> !UnwindSafe for Password<'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>,