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 stay `pub`: `type/tests/http_url` reads them directly, so this is
9/// published API and §17.14 does not recall it (semver). Mutators stay
10/// `pub(super)` — nothing 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 #[get_mut(pub(super))]
15 #[set(pub(super))]
16 pub protocol: String,
17 /// The host part of the URL.
18 #[get(type(clone))]
19 #[get_mut(pub(super))]
20 #[set(pub(super))]
21 pub host: Option<String>,
22 /// The port number in the URL, if specified.
23 #[get(type(clone))]
24 #[get_mut(pub(super))]
25 #[set(pub(super))]
26 pub port: Option<u16>,
27 /// The path in the URL.
28 #[get(type(clone))]
29 #[get_mut(pub(super))]
30 #[set(pub(super))]
31 pub path: Option<String>,
32 /// The query string in the URL.
33 #[get(type(clone))]
34 #[get_mut(pub(super))]
35 #[set(pub(super))]
36 pub query: Option<String>,
37 /// The fragment identifier.
38 #[get(type(clone))]
39 #[get_mut(pub(super))]
40 #[set(pub(super))]
41 pub fragment: Option<String>,
42}