Struct password_hash::ParamsString
source · [−]pub struct ParamsString(_);
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
sourceimpl 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]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[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
sourceimpl Clone for ParamsString
impl Clone for ParamsString
sourcefn clone(&self) -> ParamsString
fn clone(&self) -> ParamsString
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ParamsString
impl Debug for ParamsString
sourceimpl Default for ParamsString
impl Default for ParamsString
sourcefn default() -> ParamsString
fn default() -> ParamsString
Returns the “default value” for a type. Read more
sourceimpl Display for ParamsString
impl Display for ParamsString
sourceimpl<'a> FromIterator<(Ident<'a>, Value<'a>)> for ParamsString
impl<'a> FromIterator<(Ident<'a>, Value<'a>)> for ParamsString
sourceimpl FromStr for ParamsString
impl FromStr for ParamsString
sourceimpl PartialEq<ParamsString> for ParamsString
impl PartialEq<ParamsString> for ParamsString
sourcefn eq(&self, other: &ParamsString) -> bool
fn eq(&self, other: &ParamsString) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ParamsString) -> bool
fn ne(&self, other: &ParamsString) -> bool
This method tests for !=
.
impl Eq for ParamsString
impl StructuralEq for ParamsString
impl StructuralPartialEq for ParamsString
Auto Trait Implementations
impl RefUnwindSafe for ParamsString
impl Send for ParamsString
impl Sync for ParamsString
impl Unpin for ParamsString
impl UnwindSafe for ParamsString
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more