From b80408d80619ac014a5cedf5079967c20058532d Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 20 Nov 2023 16:40:46 +0100 Subject: [PATCH] Change impl of ObjectId::parse It should be consistent with Url::parse --- src/fetch/collection_id.rs | 7 ++----- src/fetch/object_id.rs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/fetch/collection_id.rs b/src/fetch/collection_id.rs index 068ab0b..46f9ac2 100644 --- a/src/fetch/collection_id.rs +++ b/src/fetch/collection_id.rs @@ -20,12 +20,9 @@ where for<'de2> ::Kind: Deserialize<'de2>, { /// Construct a new CollectionId instance - pub fn parse(url: T) -> Result - where - T: TryInto, - url::ParseError: From<>::Error>, + pub fn parse(url: &str) -> Result { - Ok(Self(Box::new(url.try_into()?), PhantomData::)) + Ok(Self(Box::new(Url::parse(url)?), PhantomData::)) } /// Fetches collection over HTTP diff --git a/src/fetch/object_id.rs b/src/fetch/object_id.rs index 921951c..00801db 100644 --- a/src/fetch/object_id.rs +++ b/src/fetch/object_id.rs @@ -65,12 +65,9 @@ where for<'de2> ::Kind: serde::Deserialize<'de2>, { /// Construct a new objectid instance - pub fn parse(url: T) -> Result - where - T: TryInto, - url::ParseError: From<>::Error>, + pub fn parse(url: &str) -> Result { - Ok(ObjectId(Box::new(url.try_into()?), PhantomData::)) + Ok(Self(Box::new(Url::parse(url)?), PhantomData::)) } /// Returns a reference to the wrapped URL value