use crate::error::Error;
use crate::tracker::Url;
pub trait IntoUrl {
fn into_url(self) -> Result<Url, Error>;
}
impl IntoUrl for Url {
fn into_url(self) -> Result<Url, Error> {
Ok(self)
}
}
impl IntoUrl for &str {
fn into_url(self) -> Result<Url, Error> {
Url::parse(self).map_err(Error::invalid_input)
}
}
impl IntoUrl for String {
fn into_url(self) -> Result<Url, Error> {
self.as_str().into_url()
}
}
impl IntoUrl for &String {
fn into_url(self) -> Result<Url, Error> {
self.as_str().into_url()
}
}