Expand description
Authority Component
See [RFC3986, Section 3.2].
Examples
use std::convert::TryFrom;
use uriparse::Authority;
let authority = Authority::try_from("example.com").unwrap();
let host = authority.into_parts().2;
let authority =
Authority::from_parts(Some("username"), Some("password"), host, Some(80)).unwrap();
assert_eq!(authority.to_string(), "username:password@example.com:80");
Equality
While many components in this library support string comparison, Authority
does not. This
comes down to it just being too expensive to do a proper host comparison. To do so would require
conversion to IpAddr
, which in the case of Ipv6Addr
can be expensive.
Structs
The authority component as defined in [RFC3986, Section 3.2].
The password component of the authority as defined in [RFC3986, Section 3.2.1].
A host that is a registered name (i.e. not an IP literal).
An error representing an invalid registered name.
The username component of the authority as defined in [RFC3986, Section 3.2.1].
Enums
An error representing an invalid authority.
The host component of the authority as defined in [RFC3986, Section 3.2.2].
An error representing an invalid host.
An error representing an invalid password component.
An error representing an invalid port.
An error representing an invalid username component.
Functions
Parses the port from the given byte string.