diff --git a/src/parser.rs b/src/parser.rs index d9700bc..a126429 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -19,6 +19,9 @@ use crate::{ Uuid, }; +#[cfg(feature = "std")] +use crate::std::string::String; + impl str::FromStr for Uuid { type Err = Error; @@ -35,6 +38,15 @@ impl TryFrom<&'_ str> for Uuid { } } +#[cfg(feature = "std")] +impl TryFrom for Uuid { + type Error = Error; + + fn try_from(uuid_str: String) -> Result { + Uuid::try_from(uuid_str.as_ref()) + } +} + impl Uuid { /// Parses a `Uuid` from a string of hexadecimal digits with optional /// hyphens.