Change impl of ObjectId::parse (#84)
* Change impl of ObjectId::parse It should be consistent with Url::parse * fmt
This commit is contained in:
parent
33649b43b7
commit
69b80aa6e1
2 changed files with 4 additions and 12 deletions
|
@ -20,12 +20,8 @@ where
|
|||
for<'de2> <Kind as Collection>::Kind: Deserialize<'de2>,
|
||||
{
|
||||
/// Construct a new CollectionId instance
|
||||
pub fn parse<T>(url: T) -> Result<Self, url::ParseError>
|
||||
where
|
||||
T: TryInto<Url>,
|
||||
url::ParseError: From<<T as TryInto<Url>>::Error>,
|
||||
{
|
||||
Ok(Self(Box::new(url.try_into()?), PhantomData::<Kind>))
|
||||
pub fn parse(url: &str) -> Result<Self, url::ParseError> {
|
||||
Ok(Self(Box::new(Url::parse(url)?), PhantomData::<Kind>))
|
||||
}
|
||||
|
||||
/// Fetches collection over HTTP
|
||||
|
|
|
@ -65,12 +65,8 @@ where
|
|||
for<'de2> <Kind as Object>::Kind: serde::Deserialize<'de2>,
|
||||
{
|
||||
/// Construct a new objectid instance
|
||||
pub fn parse<T>(url: T) -> Result<Self, url::ParseError>
|
||||
where
|
||||
T: TryInto<Url>,
|
||||
url::ParseError: From<<T as TryInto<Url>>::Error>,
|
||||
{
|
||||
Ok(ObjectId(Box::new(url.try_into()?), PhantomData::<Kind>))
|
||||
pub fn parse(url: &str) -> Result<Self, url::ParseError> {
|
||||
Ok(Self(Box::new(Url::parse(url)?), PhantomData::<Kind>))
|
||||
}
|
||||
|
||||
/// Returns a reference to the wrapped URL value
|
||||
|
|
Loading…
Reference in a new issue