@@ -20,10 +20,14 @@ use zeroize::Zeroizing;
20
20
/// # Ok(()) } fn main() { test().unwrap(); }
21
21
/// ```
22
22
pub struct Password < ' a > {
23
+ /// Message of the confirmation prompt.
23
24
prompt : String ,
25
+ /// Whether to print a confirmation message after selecting a password.
24
26
report : bool ,
25
27
theme : & ' a dyn Theme ,
28
+ /// Whether an empty password is allowed.
26
29
allow_empty_password : bool ,
30
+ // Confirmation prompt for passwords: see [`with_confirmation`](#method::with_confirmation).
27
31
confirmation_prompt : Option < ( String , String ) > ,
28
32
}
29
33
@@ -47,15 +51,19 @@ impl Password<'_> {
47
51
self
48
52
}
49
53
50
- /// Indicate whether to report confirmation after interaction.
54
+ /// Indicate whether to report a confirmation after interaction.
51
55
///
52
56
/// The default is to report.
53
57
pub fn report ( & mut self , val : bool ) -> & mut Self {
54
58
self . report = val;
55
59
self
56
60
}
57
61
58
- /// Enables confirmation prompting.
62
+ /// Enable prompting for confirmation of the password:
63
+ /// if set, the user must type the same password again to confirm their choice.
64
+ ///
65
+ /// `prompt` is the prompt message for the confirmation prompt,
66
+ /// `mismatch_err` the error message printed upon mismatching passwords.
59
67
pub fn with_confirmation < A , B > ( & mut self , prompt : A , mismatch_err : B ) -> & mut Self
60
68
where
61
69
A : Into < String > ,
@@ -65,9 +73,9 @@ impl Password<'_> {
65
73
self
66
74
}
67
75
68
- /// Allows/Disables empty password.
76
+ /// Allow/disallow entering an empty password.
69
77
///
70
- /// By default this setting is set to false (i.e. password is not empty ).
78
+ /// By default this setting is set to false (i.e. empty passwords are not allowed ).
71
79
pub fn allow_empty_password ( & mut self , allow_empty_password : bool ) -> & mut Self {
72
80
self . allow_empty_password = allow_empty_password;
73
81
self
0 commit comments