Function parse_url

Source
pub fn parse_url(input: &str) -> ParsedURL
Expand description

Parses a URL string into its components

This function takes a URL string and parses it into a ParsedURL struct containing the individual components like protocol, host, path, etc.

§Arguments

  • input - The URL string to parse

§Returns

  • ParsedURL - A struct containing the parsed URL components:
    • protocol: The URL protocol/scheme (e.g. “http:”, “https:”)
    • host: The host portion including port if specified (e.g. “example.com:8080”)
    • hostname: The hostname without port (e.g. “example.com”)
    • auth: Authentication credentials if present (e.g. “username:password”)
    • pathname: The path portion (e.g. “/path/to/resource”)
    • search: The query string portion (e.g. “?key=value”)
    • hash: The fragment identifier (e.g. “#section1”)
    • href: The complete URL string
    • protocol_relative: Whether URL is protocol-relative (starts with “//”)