From 4b7bd8e2215abc03fdcf647f92b628fb9735328d Mon Sep 17 00:00:00 2001 From: kirbylife Date: Sun, 21 Mar 2021 01:33:56 -0600 Subject: [PATCH] Implement the IntoUrl trait to url::Url struct --- src/into_url.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/into_url.rs b/src/into_url.rs index 5bf8405..2d51f9c 100644 --- a/src/into_url.rs +++ b/src/into_url.rs @@ -2,6 +2,12 @@ pub trait IntoUrl { fn into_url(self) -> Result; } +impl IntoUrl for url::Url { + fn into_url(self) -> Result { + Ok(self) + } +} + impl<'a> IntoUrl for &'a str { fn into_url(self) -> Result { url::Url::parse(self)