pub struct Password(/* private fields */);Expand description
Secret string memory-wiped on drop and obfuscated in Debug output.
Implementations§
Source§impl Password
impl Password
Sourcepub fn new<S: Into<String>>(pass: S) -> Self
pub fn new<S: Into<String>>(pass: S) -> Self
Wrap a plaintext password. The value is zeroized when the
Password is dropped.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the password as a string slice. Use sparingly — the returned reference is not zeroized.
Sourcepub fn as_imap_quoted(&self) -> Result<String, ClientError>
pub fn as_imap_quoted(&self) -> Result<String, ClientError>
Render the password as an IMAP quoted string (RFC 9051 §4.3),
escaping the two quoted-specials (\, ").
Returns ClientError::CommandFailed if the secret contains a
character that cannot appear inside a quoted string (CR, LF,
NUL, or any 8-bit byte). Callers facing an 8-bit secret should
use Session::authenticate_plain which
transports the secret as base64 over a SASL exchange.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Password
impl RefUnwindSafe for Password
impl Send for Password
impl Sync for Password
impl Unpin for Password
impl UnsafeUnpin for Password
impl UnwindSafe for Password
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more