Skip to main content

HttpRequestView

Trait HttpRequestView 

Source
pub trait HttpRequestView {
    // Required methods
    fn method(&self) -> HttpMethod;
    fn target(&self) -> &str;
    fn header_value(&self, name: &str, index: usize) -> Option<&str>;
    fn body(&self) -> &[u8] ;

    // Provided methods
    fn take_body_stream(&self) -> Option<StreamingBody> { ... }
    fn peer_addr(&self) -> Option<SocketAddr> { ... }
    fn scheme(&self) -> &str { ... }
}
Expand description

Borrowed request access used by in-memory and native HTTP adapters.

Adapters can implement this trait directly over their receive buffer so dispatch does not require copying the target, headers, or body.

Required Methods§

Source

fn method(&self) -> HttpMethod

Source

fn target(&self) -> &str

Source

fn header_value(&self, name: &str, index: usize) -> Option<&str>

Source

fn body(&self) -> &[u8]

Provided Methods§

Source

fn take_body_stream(&self) -> Option<StreamingBody>

Transfers a pull-based request body to the operation, when supported.

Source

fn peer_addr(&self) -> Option<SocketAddr>

Address of the direct network peer, when known by the adapter.

Source

fn scheme(&self) -> &str

Original transport scheme before trusted proxy normalization.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§