pub struct SaltString { /* private fields */ }Expand description
Owned stack-allocated equivalent of Salt.
Implementations§
Source§impl SaltString
impl SaltString
Sourcepub fn generate(rng: impl CryptoRngCore) -> SaltString
pub fn generate(rng: impl CryptoRngCore) -> SaltString
Generate a random B64-encoded SaltString.
Sourcepub fn from_b64(s: &str) -> Result<SaltString, Error>
pub fn from_b64(s: &str) -> Result<SaltString, Error>
Create a new SaltString from the given B64-encoded input string,
validating Salt::MIN_LENGTH and Salt::MAX_LENGTH restrictions.
Sourcepub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
pub fn decode_b64<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Decode this SaltString from B64 into the provided output buffer.
Sourcepub fn encode_b64(input: &[u8]) -> Result<SaltString, Error>
pub fn encode_b64(input: &[u8]) -> Result<SaltString, Error>
Encode the given byte slice as B64 into a new SaltString.
Returns Error if the slice is too long.
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.
Sourcepub fn new(s: &str) -> Result<SaltString, Error>
👎Deprecated since 0.5.0: use from_b64 instead
pub fn new(s: &str) -> Result<SaltString, Error>
use from_b64 instead
Create a new SaltString from the given B64-encoded input string,
validating Salt::MIN_LENGTH and Salt::MAX_LENGTH restrictions.
Sourcepub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
👎Deprecated since 0.5.0: use decode_b64 instead
pub fn b64_decode<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
use decode_b64 instead
Decode this SaltString from B64 into the provided output buffer.
Sourcepub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
👎Deprecated since 0.5.0: use encode_b64 instead
pub fn b64_encode(input: &[u8]) -> Result<SaltString, Error>
use encode_b64 instead
Encode the given byte slice as B64 into a new SaltString.
Returns Error if the slice is too long.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SaltString
impl Debug for SaltString
Source§impl Display for SaltString
impl Display for SaltString
impl Eq 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>
Source§impl PartialEq for SaltString
impl PartialEq for SaltString
Source§fn eq(&self, other: &SaltString) -> bool
fn eq(&self, other: &SaltString) -> bool
self and other values to be equal, and is used by ==.Auto Trait Implementations§
impl Freeze for SaltString
impl RefUnwindSafe for SaltString
impl Send for SaltString
impl Sync for SaltString
impl Unpin for SaltString
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.