http_type/http_url/
type.rs

1use crate::*;
2
3/// A struct representing a parsed URL with various components.
4///
5/// This struct is used to store the different components of a URL, such as the scheme,
6/// username, password, host, port, path, query, and fragment. It allows for easy
7/// handling and manipulation of URL data.
8///
9/// # Fields
10/// - `scheme`: The URL scheme (e.g., "http", "https") as a string, or `None` if not specified.
11/// - `host`: The host portion of the URL (e.g., "example.com"), or `None` if not specified.
12/// - `port`: The port number, if specified, or `None` if not specified.
13/// - `path`: The path portion of the URL (e.g., "/path/to/resource"), or `None` if not specified.
14/// - `query`: The query string, if present, or `None` if not specified.
15/// - `fragment`: The fragment identifier, if present, or `None` if not specified.
16///
17/// This struct is primarily used for holding the components of a URL after parsing, allowing
18/// for easy manipulation and access to the individual components.
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub struct HttpUrlComponents {
21    pub protocol: Protocol,
22    pub host: OptionString,
23    pub port: OptionU16,
24    pub path: OptionString,
25    pub query: OptionString,
26    pub fragment: OptionString,
27}