Implement the IntoUrl trait to url::Url struct
parent
ded3cc4074
commit
4b7bd8e221
|
@ -2,6 +2,12 @@ pub trait IntoUrl {
|
||||||
fn into_url(self) -> Result<url::Url, url::ParseError>;
|
fn into_url(self) -> Result<url::Url, url::ParseError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoUrl for url::Url {
|
||||||
|
fn into_url(self) -> Result<url::Url, url::ParseError> {
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> IntoUrl for &'a str {
|
impl<'a> IntoUrl for &'a str {
|
||||||
fn into_url(self) -> Result<url::Url, url::ParseError> {
|
fn into_url(self) -> Result<url::Url, url::ParseError> {
|
||||||
url::Url::parse(self)
|
url::Url::parse(self)
|
||||||
|
|
Loading…
Reference in New Issue