pub struct HttpUrlComponents {
pub protocol: String,
pub host: Option<String>,
pub port: Option<u16>,
pub path: Option<String>,
pub query: Option<String>,
pub fragment: Option<String>,
}Expand description
Represents the components of a parsed HTTP URL.
This struct holds various parts of a URL, including the protocol, host, port, path, query, and fragment, allowing for structured access to URL information.
The fields stay pub: type/tests/http_url reads them directly, so this is
published API and §17.14 does not recall it (semver). Mutators stay
pub(super) — nothing outside this crate builds the value.
Fields§
§protocol: StringThe URL scheme, such as “http” or “https”.
host: Option<String>The host part of the URL.
port: Option<u16>The port number in the URL, if specified.
path: Option<String>The path in the URL.
query: Option<String>The query string in the URL.
fragment: Option<String>The fragment identifier.
Implementations§
Source§impl HttpUrlComponents
impl HttpUrlComponents
Sourcepub fn parse<U>(url: U) -> Result<HttpUrlComponents, HttpUrlError>
pub fn parse<U>(url: U) -> Result<HttpUrlComponents, HttpUrlError>
Source§impl HttpUrlComponents
impl HttpUrlComponents
pub fn get_protocol(&self) -> &String
pub fn get_host(&self) -> Option<String>
pub fn try_get_host(&self) -> Option<String>
pub fn get_port(&self) -> Option<u16>
pub fn try_get_port(&self) -> Option<u16>
pub fn get_path(&self) -> Option<String>
pub fn try_get_path(&self) -> Option<String>
pub fn get_query(&self) -> Option<String>
pub fn try_get_query(&self) -> Option<String>
pub fn get_fragment(&self) -> Option<String>
pub fn try_get_fragment(&self) -> Option<String>
Trait Implementations§
Source§impl Clone for HttpUrlComponents
impl Clone for HttpUrlComponents
Source§fn clone(&self) -> HttpUrlComponents
fn clone(&self) -> HttpUrlComponents
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpUrlComponents
impl Debug for HttpUrlComponents
Source§impl Default for HttpUrlComponents
impl Default for HttpUrlComponents
Source§fn default() -> HttpUrlComponents
fn default() -> HttpUrlComponents
Returns the “default value” for a type. Read more
impl Eq for HttpUrlComponents
Source§impl PartialEq for HttpUrlComponents
impl PartialEq for HttpUrlComponents
impl StructuralPartialEq for HttpUrlComponents
Auto Trait Implementations§
impl Freeze for HttpUrlComponents
impl RefUnwindSafe for HttpUrlComponents
impl Send for HttpUrlComponents
impl Sync for HttpUrlComponents
impl Unpin for HttpUrlComponents
impl UnsafeUnpin for HttpUrlComponents
impl UnwindSafe for HttpUrlComponents
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more