From 69b80aa6e1bd20636420968f564a6748c73d91f2 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 24 Nov 2023 11:21:00 +0100 Subject: [PATCH] Change impl of ObjectId::parse (#84) * Change impl of ObjectId::parse It should be consistent with Url::parse * fmt --- src/fetch/collection_id.rs | 8 ++------ src/fetch/object_id.rs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/fetch/collection_id.rs b/src/fetch/collection_id.rs index 068ab0b..ae17ca0 100644 --- a/src/fetch/collection_id.rs +++ b/src/fetch/collection_id.rs @@ -20,12 +20,8 @@ where for<'de2> ::Kind: Deserialize<'de2>, { /// Construct a new CollectionId instance - pub fn parse(url: T) -> Result - where - T: TryInto, - url::ParseError: From<>::Error>, - { - Ok(Self(Box::new(url.try_into()?), PhantomData::)) + pub fn parse(url: &str) -> Result { + 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..179a82c 100644 --- a/src/fetch/object_id.rs +++ b/src/fetch/object_id.rs @@ -65,12 +65,8 @@ 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>, - { - Ok(ObjectId(Box::new(url.try_into()?), PhantomData::)) + pub fn parse(url: &str) -> Result { + Ok(Self(Box::new(Url::parse(url)?), PhantomData::)) } /// Returns a reference to the wrapped URL value