new_password = password
.ok_or(())
.or_else(|_| rpassword::prompt_password("New password: "))
.context("Password change aborted")?;
password: Option<String>
new_password: String
`let new_password = match password { Some(pw) => pw, None => { rpassword::prompt_password("New password: ") .context("Password change aborted")? } };`
Обсуждают сегодня