pub fn parse(route_string: &str) -> Result<RouteInfo, RoutingError> {
        // Perform some validation on the string before parsing it.
        if let Some(first_character) = route_string.chars().next() {
            let full_url: String = if first_character == '/' {
//                eprintln!("does not start with slash: '{}'", route_string);
                format!("http://dummy_url.com{}", route_string)
//                return Err(RoutingError::RouteDoesNotStartWithSlash)
            } else {
                route_string.to_string()
            };
            Url::parse(&full_url)
                .map(RouteInfo::from)
                .map_err(|_| RoutingError::CouldNotParseRoute { route: route_string.to_string() })
        } else {
            return Err(RoutingError::RouteIsEmpty)
        }
    }
/// Given either a string with a leading slash, or a full url, parse the string into a route info.
Given either a string with a leading slash, or a full url, parse the string into a route info.
Given either a string with a leading slash or a full url parse the string into a route info .
pub fn parse(route_string: &str) -> Result<RouteInfo, RoutingError> {
        // Perform some validation on the string before parsing it.
        if let Some(first_character) = route_string.chars().next() {
            let full_url: String = if first_character == '/' {
//                eprintln!("does not start with slash: '{}'", route_string);
                format!("http://dummy_url.com{}", route_string)
//                return Err(RoutingError::RouteDoesNotStartWithSlash)
            } else {
                route_string.to_string()
            };
            Url::parse(&full_url)
                .map(RouteInfo::from)
                .map_err(|_| RoutingError::CouldNotParseRoute { route: route_string.to_string() })
        } else {
            return Err(RoutingError::RouteIsEmpty)
        }
    }
pub fn parse ( route_string : & str ) -> Result < RouteInfo , RoutingError > { // Perform some validation on the string before parsing it. if let Some ( first_character ) = route_string . chars ( ) . next ( ) { let full_url : String = if first_character == '/' { //                eprintln!("does not start with slash: '{}'", route_string); format ! ( " " route_string ) //                return Err(RoutingError::RouteDoesNotStartWithSlash) } else { route_string . to_string ( ) } ; Url :: parse ( & full_url ) . map ( RouteInfo :: from ) . map_err ( | _ | RoutingError :: CouldNotParseRoute { route : route_string . to_string ( ) } ) } else { return Err ( RoutingError :: RouteIsEmpty ) } }
Given either a string with a leading slash, or a full url, parse the string into a route info.
Given either a string with a leading slash or a full url parse the string into a route info .
route_string
&str
route_string
&str