From bbbe362740d944661d6e126cb50a05fb5e87e054 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 9 Mar 2021 16:55:57 -0800 Subject: [PATCH] Indirectly use 'Uuid::Error' for backwards compat. Closes #1565. --- contrib/lib/src/uuid.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/lib/src/uuid.rs b/contrib/lib/src/uuid.rs index 9ac4da98..d3ca64a0 100644 --- a/contrib/lib/src/uuid.rs +++ b/contrib/lib/src/uuid.rs @@ -70,6 +70,8 @@ use rocket::form::{self, FromFormField, ValueField}; #[serde(transparent)] pub struct Uuid(_uuid::Uuid); +pub type Error = <_uuid::Uuid as std::str::FromStr>::Err; + impl Uuid { /// Consumes the Uuid wrapper, returning the underlying `Uuid` type. /// @@ -102,9 +104,8 @@ impl fmt::Display for Uuid { } } - impl<'a> FromParam<'a> for Uuid { - type Error = _uuid::Error; + type Error = Error; /// A value is successfully parsed if `param` is a properly formatted Uuid. /// Otherwise, an error is returned. @@ -121,7 +122,7 @@ impl<'v> FromFormField<'v> for Uuid { } impl FromStr for Uuid { - type Err = _uuid::Error; + type Err = Error; #[inline] fn from_str(s: &str) -> Result {