Skip to main content

Module input_ext

Module input_ext 

Available on crate feature net only.
Expand description

Small, single-concern accessor traits for reading routing/transport properties off a service input (an http request, a connect target, …).

Each concern (URI, path, authority, protocol, http version, transport) is its own small trait, so a caller reads exactly the piece it needs instead of building a combined context up front.

Design (matching ClientIp): each resolution trait has no ExtensionsRef bound and is never blanket-derived from another trait — every input type opts in with the resolution that fits it (the http Request/Parts impls in rama-http-types walk the uri → TLS SNI → ForwardedHost fallback chain; a transport target resolves its authority directly). The only blanket impls are the trivial reference-forwarding ones and the composed ConnectorTargetInputExt, whose method is purely derived.

The return type is the fallibility contract: an Option may be absent (a caller that requires it does .ok_or_else(|| …)? with its own error); transport_protocol is always known, so it returns a bare value.

Each resolution trait also carries default methods built on its one required accessor (e.g. AuthorityInputExt::host_as_domain), so callers get ergonomic projections without re-writing the same closure chains.

Traits§

AuthorityInputExt
Read the routing authority (host[:port]) of a service input.
ConnectorTargetInputExtstd
Resolve the transport address (host:port) to connect to: the routing authority with the application protocol’s default port as the port fallback.
HttpVersionInputExthttp
Read the negotiated HTTP Version of a service input.
PathInputExt
Read the URI path of a service input.
ProtocolInputExt
Read the application-layer Protocol (scheme) of a service input.
TransportProtocolInputExt
Read the transport-layer TransportProtocol (TCP/UDP) of a service input.
UriInputExt
Read the Uri of a service input that carries one.