Skip to main content

ProtocolInputExt

Trait ProtocolInputExt 

pub trait ProtocolInputExt {
    // Required method
    fn protocol(&self) -> Option<&Protocol>;

    // Provided methods
    fn target_protocol(&self) -> Option<&Protocol> { ... }
    fn protocol_default_port(&self) -> Option<u16> { ... }
}
Available on crate feature net only.
Expand description

Read the application-layer Protocol (scheme) of a service input.

Required Methods§

fn protocol(&self) -> Option<&Protocol>

The application protocol, or None if it can’t be determined.

For an HTTP request this is what the end client used, and may come from forwarded context. The protocol to connect with is Self::target_protocol.

Provided Methods§

fn target_protocol(&self) -> Option<&Protocol>

The input’s own application protocol, never resolved from forwarded context.

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

The default port of the resolved Protocol (e.g. 443 for HTTPS), or None if the protocol is unknown or portless.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

§

impl<T> ProtocolInputExt for &T
where T: ProtocolInputExt + ?Sized,

Implementors§