[][src]Module uriparse::authority

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].

InvalidRegisteredName

An error representing an invalid registered name.

Password

The password component of the authority as defined in [RFC3986, Section 3.2.1].

RegisteredName

A host that is a registered name (i.e. not an IP literal).

Username

The username component of the authority as defined in [RFC3986, Section 3.2.1].

Enums

Host

The host component of the authority as defined in [RFC3986, Section 3.2.2].

InvalidAuthority

An error representing an invalid authority.

InvalidHost

An error representing an invalid host.

InvalidPort

An error representing an invalid port.

InvalidUserInfo

An error representing an invalid user information component.