Struct sequoia_openpgp::crypto::Password
source · pub struct Password(/* private fields */);
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§
source§impl Password
impl Password
sourcepub fn map<F, T>(&self, fun: F) -> T
pub fn map<F, T>(&self, fun: F) -> 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§
source§impl PartialEq for Password
impl PartialEq for Password
impl Eq for Password
impl StructuralPartialEq for Password
Auto Trait Implementations§
impl Freeze for Password
impl RefUnwindSafe for Password
impl Send for Password
impl Sync for Password
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)