pub struct Target<'a> {
pub scheme: Scheme,
pub host: &'a str,
pub port: u16,
pub path_and_query: Cow<'a, str>,
}Expand description
A parsed absolute URL: the origin and what is sent as the request target.
Fields§
§scheme: SchemeThe scheme.
host: &'a strA registered name or an IP address; an IPv6 literal without its brackets. Case as written.
port: u16The port, the scheme’s default when the URL names none.
path_and_query: Cow<'a, str>The path and query, never empty: an empty path is /, and a query
without a path is /?query (RFC 9112 §3.2.1).
Implementations§
Source§impl<'a> Target<'a>
impl<'a> Target<'a>
The authority as sent in Host or :authority: brackets around an
IPv6 literal, :port only when it is not the scheme’s default.
Sourcepub fn parse(input: &'a str) -> Result<Target<'a>, DecodeError>
pub fn parse(input: &'a str) -> Result<Target<'a>, DecodeError>
Parses an absolute http or https URL.
§Errors
DecodeError::Malformed naming the rule: "scheme", "userinfo",
"host", "IPv6 literal", "port", or
"a byte outside visible ASCII: percent-encode it".
Trait Implementations§
impl<'a> Eq for Target<'a>
impl<'a> StructuralPartialEq for Target<'a>
Auto Trait Implementations§
impl<'a> Forget for Target<'a>
impl<'a> Freeze for Target<'a>
impl<'a> Move for Target<'a>
impl<'a> RefUnwindSafe for Target<'a>
impl<'a> Send for Target<'a>
impl<'a> Sync for Target<'a>
impl<'a> Unpin for Target<'a>
impl<'a> UnsafeUnpin for Target<'a>
impl<'a> UnwindSafe for Target<'a>
Blanket Implementations§
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