pub struct SaltString { /* private fields */ }Expand description
Owned stack-allocated equivalent of Salt.
Implementations§
Source§impl SaltString
impl SaltString
Sourcepub fn generate(rng: impl CryptoRng + RngCore) -> SaltString
pub fn generate(rng: impl CryptoRng + RngCore) -> SaltString
Generate a random B64-encoded SaltString.
Sourcepub fn new(s: &str) -> Result<SaltString, Error>
pub fn new(s: &str) -> Result<SaltString, Error>
Create a new SaltString.
Sourcepub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
pub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
Encode the given byte slice as B64 into a new SaltString.
Returns None if the slice is too long.
Sourcepub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Decode this SaltString from B64 into the provided output buffer.
Sourcepub fn as_salt(&self) -> Salt<'_>
pub fn as_salt(&self) -> Salt<'_>
Borrow the contents of a SaltString as a Salt.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the contents of a SaltString as a str.
Trait Implementations§
Source§impl AsRef<str> for SaltString
impl AsRef<str> for SaltString
Source§impl Clone for SaltString
impl Clone for SaltString
Source§fn clone(&self) -> SaltString
fn clone(&self) -> SaltString
Returns a duplicate 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 SaltString
impl Debug for SaltString
Source§impl Display for SaltString
impl Display for SaltString
Source§impl<'a> From<&'a SaltString> for Salt<'a>
impl<'a> From<&'a SaltString> for Salt<'a>
Source§fn from(salt_string: &'a SaltString) -> Salt<'a>
fn from(salt_string: &'a SaltString) -> Salt<'a>
Converts to this type from the input type.
Source§impl PartialEq for SaltString
impl PartialEq for SaltString
impl Eq for SaltString
Auto Trait Implementations§
impl Freeze for SaltString
impl RefUnwindSafe for SaltString
impl Send for SaltString
impl Sync for SaltString
impl Unpin for SaltString
impl UnwindSafe for SaltString
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