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 more