Skip to main content

UriInputExt

Trait UriInputExt 

pub trait UriInputExt {
    // Required method
    fn uri(&self) -> &Uri;
}
Available on crate feature net only.
Expand description

Read the Uri of a service input that carries one.

Unlike the other *InputExt traits (which return an Option because they resolve a property that may be absent), this is a structural capability: a type implements it only when it always has a URI, so uri() returns a &Uri directly. Plenty of inputs besides http requests carry a URI (a bare Uri, a redirect target, a url-keyed config, …), which is why this lives next to the http request impls rather than being tied to them.

Note: a UriInputExt is not automatically an AuthorityInputExt / ProtocolInputExt — an http request, for instance, resolves its authority from more than just its URI (proxy target, TLS SNI, Forwarded, Host), so those impls are deliberately per-type rather than blanket-derived from here.

Required Methods§

fn uri(&self) -> &Uri

The Uri this input carries.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl UriInputExt for Parts

§

impl UriInputExt for Uri

§

impl<Body> UriInputExt for Request<Body>