pub struct Passphrase(SecretString);
Expand description
A secret passphrase
The passphrase is held by a [SecretString
], which guarantees zeroing of memory on
destruct.
Tuple Fields§
§0: SecretString
Implementations§
Source§impl Passphrase
impl Passphrase
Sourcepub fn new(passphrase: String) -> Self
pub fn new(passphrase: String) -> Self
Creates a new Passphrase
from owned String
§Examples
use nethsm::Passphrase;
let passphrase = Passphrase::new("passphrase".to_string());
Sourcepub fn expose_owned(&self) -> String
pub fn expose_owned(&self) -> String
Exposes the secret passphrase as owned String
This is a convenience function, as much of [nethsm_sdk_rs
] exclusively deals with owned
strings.
Sourcepub fn expose_borrowed(&self) -> &str
pub fn expose_borrowed(&self) -> &str
Exposes the secret passphrase as borrowed str
Trait Implementations§
Source§impl Clone for Passphrase
impl Clone for Passphrase
Source§fn clone(&self) -> Passphrase
fn clone(&self) -> Passphrase
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Passphrase
impl Debug for Passphrase
Source§impl Default for Passphrase
impl Default for Passphrase
Source§fn default() -> Passphrase
fn default() -> Passphrase
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Passphrase
impl<'de> Deserialize<'de> for Passphrase
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromStr for Passphrase
impl FromStr for Passphrase
Source§impl Serialize for Passphrase
impl Serialize for Passphrase
Source§fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
Serializes a Passphrase
.
§Warning
This may be used to write a passphrase to file! Take precautions so that passphrases can not leak to the environment.
Auto Trait Implementations§
impl Freeze for Passphrase
impl RefUnwindSafe for Passphrase
impl Send for Passphrase
impl Sync for Passphrase
impl Unpin for Passphrase
impl UnwindSafe for Passphrase
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