Skip to main content

http_type/http_url/
struct.rs

1use super::*;
2
3/// Represents the components of a parsed HTTP URL.
4///
5/// This struct holds various parts of a URL, including the protocol, host, port,
6/// path, query, and fragment, allowing for structured access to URL information.
7///
8/// The fields are crate-internal (§17.18): a consumer reaches them through
9/// the generated `get_*` accessors. Mutators stay `pub(super)` — nothing
10/// outside this crate builds the value.
11#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
12pub struct HttpUrlComponents {
13    /// The URL scheme, such as "http" or "https".
14    pub(crate) protocol: String,
15    /// The host part of the URL.
16    #[get(type(clone))]
17    pub(crate) host: Option<String>,
18    /// The port number in the URL, if specified.
19    #[get(type(clone))]
20    pub(crate) port: Option<u16>,
21    /// The path in the URL.
22    #[get(type(clone))]
23    pub(crate) path: Option<String>,
24    /// The query string in the URL.
25    #[get(type(clone))]
26    pub(crate) query: Option<String>,
27    /// The fragment identifier.
28    #[get(type(clone))]
29    pub(crate) fragment: Option<String>,
30}