pkstrings: implement TryFrom<&str> via TryFrom<String>
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
0ecc19a2fc
commit
19853cec29
1 changed files with 1 additions and 7 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue