Implement `FromStr` for public sodium types.
@@ -260,6 +260,13 @@ macro_rules! implement_public_sodium_wrapper {
}
}
+ impl ::std::str::FromStr for $name {
+ type Err = ::encoding::serialize::FromHexError;
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ $name::from_hex(s)
+ }
+ }
+
impl fmt::Debug for $name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, stringify!($name))?;
