Struct dialoguer::PasswordInput
source · pub struct PasswordInput<'a> { /* private fields */ }
Expand description
Renders a password input prompt.
Example usage
use 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());
Implementations
sourceimpl<'a> PasswordInput<'a>
impl<'a> PasswordInput<'a>
sourcepub fn new() -> PasswordInput<'static>
pub fn new() -> PasswordInput<'static>
Creates a new input prompt.
sourcepub fn with_theme(theme: &'a dyn Theme) -> PasswordInput<'a>
pub fn with_theme(theme: &'a dyn Theme) -> PasswordInput<'a>
Creates the password input with a specific theme.
sourcepub fn with_prompt(&mut self, prompt: &str) -> &mut PasswordInput<'a>
pub fn with_prompt(&mut self, prompt: &str) -> &mut PasswordInput<'a>
Sets the prompt.
sourcepub fn with_confirmation(
&mut self,
prompt: &str,
mismatch_err: &str
) -> &mut PasswordInput<'a>
pub fn with_confirmation(
&mut self,
prompt: &str,
mismatch_err: &str
) -> &mut PasswordInput<'a>
Enables confirmation prompting.
sourcepub fn interact(&self) -> Result<String>
pub fn interact(&self) -> Result<String>
Enables user interaction and returns the result.
If the user confirms the result is true
, false
otherwise.
The dialog is rendered on stderr.
sourcepub fn interact_on(&self, term: &Term) -> Result<String>
pub fn interact_on(&self, term: &Term) -> Result<String>
Like interact
but allows a specific terminal to be set.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for PasswordInput<'a>
impl<'a> !Send for PasswordInput<'a>
impl<'a> !Sync for PasswordInput<'a>
impl<'a> Unpin for PasswordInput<'a>
impl<'a> !UnwindSafe for PasswordInput<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more