Skip to main content

AuthorityInputExt

Trait AuthorityInputExt 

pub trait AuthorityInputExt {
    // Required method
    fn authority(&self) -> Option<HostWithOptPort>;

    // Provided methods
    fn host(&self) -> Option<Host> { ... }
    fn host_as_domain(&self) -> Option<Domain> { ... }
    fn port(&self) -> Option<u16> { ... }
    fn authority_with_default_port(
        &self,
        fallback: Option<u16>,
    ) -> Option<HostWithPort>
       where Self: ProtocolInputExt { ... }
}
Available on crate feature net only.
Expand description

Read the routing authority (host[:port]) of a service input.

This is the HTTP routing authority — the :authority pseudo-header / Host header target — so it is a HostWithOptPort, not the RFC-3986 Authority type (userinfo is never used for routing). Returns None when no authority can be resolved.

Required Methods§

fn authority(&self) -> Option<HostWithOptPort>

The routing authority (host[:port]), or None if none is resolvable.

Provided Methods§

fn host(&self) -> Option<Host>

The authority Host, dropping any port.

fn host_as_domain(&self) -> Option<Domain>

The authority host as a Domain, or None if absent or not a domain (e.g. an IP literal).

fn port(&self) -> Option<u16>

The authority port, if one is set explicitly.

fn authority_with_default_port( &self, fallback: Option<u16>, ) -> Option<HostWithPort>
where Self: ProtocolInputExt,

Resolve the logical authority with its explicit port, the application protocol’s default port, or finally fallback.

This does not apply a connector target override. None means the host or port could not be resolved. Use Self::authority when retaining a portless authority is useful.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<T> AuthorityInputExt for &T

Implementors§