pub fn new(url: Url, authorization: Option<ProxyBasicAuthorization>) -> Result<Self> {
        match url.scheme() {
            "http" | "https" => (),
            scheme => {
                let msg = format!("Invalid scheme {} for {}", &scheme, &url);
                return Err(Error::InvalidProxyValue(msg));
            }
        }
        if url.host_str().is_none() {
            return Err(Error::UrlParseError(url::ParseError::EmptyHost));
        }
        if url.port_or_known_default().is_none() {
            return Err(Error::UrlParseError(url::ParseError::InvalidPort));
        }

        Ok(ProxyInfo { url, authorization })
    }
/// Create and return a new `ProxyInfo`.
///
/// # Errors
///
/// * If the proxy scheme is invalid (i.e. not `"http"` or `"https"`)
/// * If the proxy `Url` has an empty host entry
/// * If the proxy `Url` has an unknown port number
Create and return a new `ProxyInfo`.
Create and return a new ` ProxyInfo ` .
pub fn new(url: Url, authorization: Option<ProxyBasicAuthorization>) -> Result<Self> {
        match url.scheme() {
            "http" | "https" => (),
            scheme => {
                let msg = format!("Invalid scheme {} for {}", &scheme, &url);
                return Err(Error::InvalidProxyValue(msg));
            }
        }
        if url.host_str().is_none() {
            return Err(Error::UrlParseError(url::ParseError::EmptyHost));
        }
        if url.port_or_known_default().is_none() {
            return Err(Error::UrlParseError(url::ParseError::InvalidPort));
        }
        Ok(ProxyInfo { url, authorization })
    }
pub fn new ( url : Url , authorization : Option < ProxyBasicAuthorization > ) -> Result < Self > { match url . scheme ( ) { " " | " " => ( ) , scheme => { let msg = format ! ( " " scheme url ) ; return Err ( Error :: InvalidProxyValue ( msg ) ) ; } } if url . host_str ( ) . is_none ( ) { return Err ( Error :: UrlParseError ( url :: ParseError :: EmptyHost ) ) ; } if url . port_or_known_default ( ) . is_none ( ) { return Err ( Error :: UrlParseError ( url :: ParseError :: InvalidPort ) ) ; } Ok ( ProxyInfo { url , authorization } ) }
Create and return a new `ProxyInfo`.
Create and return a new ` ProxyInfo ` .
url
Url
authorization
Option<ProxyBasicAuthorization>
url
Url
authorization
Option<ProxyBasicAuthorization>
errors
If the proxy scheme is invalid
If the proxy `Url` has an empty host entry
If the proxy `Url` has an unknown port number
If the proxy scheme is invalid If the proxy ` Url ` has an empty host entry If the proxy ` Url ` has an unknown port number