Struct password_hash::ParamsString
source · pub struct ParamsString(/* private fields */);
Expand description
Algorithm parameter string.
The PHC string format specification defines a set of optional algorithm-specific name/value pairs which can be encoded into a PHC-formatted parameter string as follows:
$<param>=<value>(,<param>=<value>)*
This type represents that set of parameters.
Implementations§
source§impl ParamsString
impl ParamsString
sourcepub fn new() -> Self
pub fn new() -> Self
Create new empty ParamsString
.
sourcepub fn add_b64_bytes<'a>(
&mut self,
name: impl TryInto<Ident<'a>>,
bytes: &[u8],
) -> Result<()>
pub fn add_b64_bytes<'a>( &mut self, name: impl TryInto<Ident<'a>>, bytes: &[u8], ) -> Result<()>
Add the given byte value to the ParamsString
, encoding it as “B64”.
sourcepub fn add_decimal<'a>(
&mut self,
name: impl TryInto<Ident<'a>>,
value: Decimal,
) -> Result<()>
pub fn add_decimal<'a>( &mut self, name: impl TryInto<Ident<'a>>, value: Decimal, ) -> Result<()>
Add a key/value pair with a decimal value to the ParamsString
.
sourcepub fn add_str<'a>(
&mut self,
name: impl TryInto<Ident<'a>>,
value: impl TryInto<Value<'a>>,
) -> Result<()>
pub fn add_str<'a>( &mut self, name: impl TryInto<Ident<'a>>, value: impl TryInto<Value<'a>>, ) -> Result<()>
Add a key/value pair with a string value to the ParamsString
.
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Borrow the contents of this ParamsString
as a byte slice.
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrow the contents of this ParamsString
as a str
.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the count of the number ASCII characters in this ParamsString
.
sourcepub fn get<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<Value<'_>>
pub fn get<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<Value<'_>>
Get a parameter Value
by name.
sourcepub fn get_str<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<&str>
pub fn get_str<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<&str>
Get a parameter as a str
.
sourcepub fn get_decimal<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<Decimal>
pub fn get_decimal<'a>(&self, name: impl TryInto<Ident<'a>>) -> Option<Decimal>
Get a parameter as a Decimal
.
See Value::decimal
for format information.
Trait Implementations§
source§impl Clone for ParamsString
impl Clone for ParamsString
source§fn clone(&self) -> ParamsString
fn clone(&self) -> ParamsString
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ParamsString
impl Debug for ParamsString
source§impl Default for ParamsString
impl Default for ParamsString
source§fn default() -> ParamsString
fn default() -> ParamsString
source§impl Display for ParamsString
impl Display for ParamsString
source§impl<'a> FromIterator<(Ident<'a>, Value<'a>)> for ParamsString
impl<'a> FromIterator<(Ident<'a>, Value<'a>)> for ParamsString
source§impl FromStr for ParamsString
impl FromStr for ParamsString
source§impl PartialEq for ParamsString
impl PartialEq for ParamsString
impl Eq for ParamsString
impl StructuralPartialEq for ParamsString
Auto Trait Implementations§
impl Freeze for ParamsString
impl RefUnwindSafe for ParamsString
impl Send for ParamsString
impl Sync for ParamsString
impl Unpin for ParamsString
impl UnwindSafe for ParamsString
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)