pub struct Authority {
pub host: Host,
pub port: u16,
}Expand description
Represents a parsed authority.
Fields§
§host: HostThe host, which can be a domain or an IP address.
port: u16The port.
Implementations§
Source§impl Authority
impl Authority
Sourcepub fn parse(authority: &str) -> Result<Self, AuthorityError>
pub fn parse(authority: &str) -> Result<Self, AuthorityError>
Parses an authority (host, and optional port) from a string.
Accepts a bare IP address, a host:port or [ipv6]:port pair, or a bare
domain, in that order; the port defaults to 0 when omitted. Returns
AuthorityError::InvalidHost if none of those forms match.
Trait Implementations§
impl Eq for Authority
Source§impl From<SocketAddr> for Authority
impl From<SocketAddr> for Authority
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV4> for Authority
impl From<SocketAddrV4> for Authority
Source§fn from(value: SocketAddrV4) -> Self
fn from(value: SocketAddrV4) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV6> for Authority
impl From<SocketAddrV6> for Authority
Source§fn from(value: SocketAddrV6) -> Self
fn from(value: SocketAddrV6) -> Self
Converts to this type from the input type.
Source§impl Ord for Authority
impl Ord for Authority
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Authority
impl PartialOrd for Authority
impl StructuralPartialEq for Authority
Auto Trait Implementations§
impl Freeze for Authority
impl RefUnwindSafe for Authority
impl Send for Authority
impl Sync for Authority
impl Unpin for Authority
impl UnsafeUnpin for Authority
impl UnwindSafe for Authority
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