pub fn is_url<T>(string: T) -> Result<(), String>
where
    T: AsRef<str> + Display,
{
    match url::Url::parse(string.as_ref()) {
        Ok(url) => {
            if url.has_host() {
                Ok(())
            } else {
                Err("no host provided".to_string())
            }
        }
        Err(err) => Err(format!("{}", err)),
    }
}
// Return an error if a url cannot be parsed.
Return an error if a url cannot be parsed.
Return an error if a url cannot be parsed .
pub fn is_url<T>(string: T) -> Result<(), String>
where
    T: AsRef<str> + Display,
{
    match url::Url::parse(string.as_ref()) {
        Ok(url) => {
            if url.has_host() {
                Ok(())
            } else {
                Err("no host provided".to_string())
            }
        }
        Err(err) => Err(format!("{}", err)),
    }
}
pub fn is_url < T > ( string : T ) -> Result < ( ) , String > where T : AsRef < str > + Display , { match url :: Url :: parse ( string . as_ref ( ) ) { Ok ( url ) => { if url . has_host ( ) { Ok ( ( ) ) } else { Err ( " " . to_string ( ) ) } } Err ( err ) => Err ( format ! ( " " err ) ) , } }
Return an error if a url cannot be parsed.
Return an error if a url cannot be parsed .
string
T