Struct sequoia_openpgp::crypto::Password
source · [−]pub struct Password(_);
Expand description
Holds a password.
Password
s can be converted from various types using From
.
The password is encrypted in memory and only decrypted on demand.
See mem::Encrypted
for details.
Examples
use sequoia_openpgp as openpgp;
use openpgp::crypto::Password;
// Convert from a &str.
let p: Password = "hunter2".into();
// Convert from a &[u8].
let p: Password = b"hunter2"[..].into();
// Convert from a String.
let p: Password = String::from("hunter2").into();
// ...
Implementations
sourceimpl Password
impl Password
sourcepub fn map<F, T>(&self, fun: F) -> T where
F: FnMut(&Protected) -> T,
pub fn map<F, T>(&self, fun: F) -> T where
F: FnMut(&Protected) -> T,
Maps the given function over the password.
The password is stored encrypted in memory. This function temporarily decrypts it for the given function to use.
Examples
use sequoia_openpgp as openpgp;
use openpgp::crypto::Password;
let p: Password = "hunter2".into();
p.map(|p| assert_eq!(p.as_ref(), &b"hunter2"[..]));
Trait Implementations
impl Eq for Password
impl StructuralEq for Password
impl StructuralPartialEq for Password
Auto Trait Implementations
impl RefUnwindSafe for Password
impl Send for Password
impl Sync for Password
impl Unpin for Password
impl UnwindSafe for Password
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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