http_type/http_url/
type.rs

1use crate::protocol::r#type::Protocol;
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: Option<String>,
23    pub port: Option<u16>,
24    pub path: Option<String>,
25    pub query: Option<String>,
26    pub fragment: Option<String>,
27}