diff --git a/src/lib.rs b/src/lib.rs index 5098065..fab4ca6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -158,6 +158,12 @@ where Self(HashOfBytes::new(&Serialized::new(to_hash))) } + #[inline(always)] + #[allow(missing_docs)] + pub fn new_from_str(val: String) -> Self { + Self(HashOfBytes::new(&Serialized::new_from_str(val))) + } + #[inline(always)] #[allow(missing_docs)] pub fn hex(&self) -> String { @@ -243,6 +249,15 @@ where } } + #[allow(missing_docs)] + #[inline(always)] + pub fn new_from_str(val: String) -> Self { + Serialized { + val, + phantom: PhantomData, + } + } + /// Deserializing a type by serde_json #[inline(always)] pub fn deserialize(&self) -> T {