pkstrings: implement TryFrom<&str> via TryFrom<String>

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-06-30 00:54:18 +02:00
parent 0ecc19a2fc
commit 19853cec29
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -147,13 +147,7 @@ impl TryFrom<&str> for PKString {
type Error = Error;
fn try_from(data: &str) -> Result<PKString, Error> {
for chr in data.chars() {
if ! STRTOHEX.contains_key(&chr) {
return Err(Error::InvalidCharacter);
}
}
Ok(PKString(String::from(data)))
PKString::try_from(String::from(data))
}
}