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§
- Authority
- The authority component as defined in [RFC3986, Section 3.2].
- Password
- The password component of the authority as defined in [RFC3986, Section 3.2.1].
- Registered
Name - A host that is a registered name (i.e. not an IP literal).
- Registered
Name Error - An error representing an invalid registered name.
- Username
- The username component of the authority as defined in [RFC3986, Section 3.2.1].
Enums§
- Authority
Error - An error representing an invalid authority.
- Host
- The host component of the authority as defined in [RFC3986, Section 3.2.2].
- Host
Error - An error representing an invalid host.
- Password
Error - An error representing an invalid password component.
- Port
Error - An error representing an invalid port.
- Username
Error - An error representing an invalid username component.
Functions§
- parse_
port - Parses the port from the given byte string.