Skip to main content

TransportAddressInputExt

Trait TransportAddressInputExt 

pub trait TransportAddressInputExt:
    AuthorityInputExt
    + ProtocolInputExt
    + Sealed {
    // Provided methods
    fn host_with_port(&self) -> Option<HostWithPort> { ... }
    fn host_with_port_or(&self, default_port: u16) -> Option<HostWithPort> { ... }
}
Available on crate feature net only.
Expand description

Resolve the transport address (host:port) to connect to: the routing authority with the application protocol’s default port as the port fallback.

Auto-implemented (and sealed) for every input that is both an AuthorityInputExt and a ProtocolInputExt; it yields the typed host:port a connector needs, and is never implemented by hand.

Provided Methods§

fn host_with_port(&self) -> Option<HostWithPort>

The host:port to connect to: the authority’s port if set, else the protocol’s default port. None when no host (or no port) resolves.

fn host_with_port_or(&self, default_port: u16) -> Option<HostWithPort>

Like host_with_port but with default_port as the ultimate fallback (authority port → protocol default → default_port), so it yields Some whenever an authority resolves at all.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§