Skip to content

Commit f101308

Browse files
committed
doc: document members of password.rs.
1 parent d76bd1e commit f101308

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/prompts/password.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ use zeroize::Zeroizing;
2020
/// # Ok(()) } fn main() { test().unwrap(); }
2121
/// ```
2222
pub struct Password<'a> {
23+
/// Message of the confirmation prompt.
2324
prompt: String,
25+
/// Whether to print a confirmation message after selecting a password.
2426
report: bool,
2527
theme: &'a dyn Theme,
28+
/// Whether an empty password is allowed.
2629
allow_empty_password: bool,
30+
// Confirmation prompt for passwords: see [`with_confirmation`](#method::with_confirmation).
2731
confirmation_prompt: Option<(String, String)>,
2832
}
2933

@@ -47,15 +51,19 @@ impl Password<'_> {
4751
self
4852
}
4953

50-
/// Indicate whether to report confirmation after interaction.
54+
/// Indicate whether to report a confirmation after interaction.
5155
///
5256
/// The default is to report.
5357
pub fn report(&mut self, val: bool) -> &mut Self {
5458
self.report = val;
5559
self
5660
}
5761

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.
5967
pub fn with_confirmation<A, B>(&mut self, prompt: A, mismatch_err: B) -> &mut Self
6068
where
6169
A: Into<String>,
@@ -65,9 +73,9 @@ impl Password<'_> {
6573
self
6674
}
6775

68-
/// Allows/Disables empty password.
76+
/// Allow/disallow entering an empty password.
6977
///
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).
7179
pub fn allow_empty_password(&mut self, allow_empty_password: bool) -> &mut Self {
7280
self.allow_empty_password = allow_empty_password;
7381
self

0 commit comments

Comments
 (0)