Skip to main content

HttpRequestParts

Trait HttpRequestParts 

Source
pub trait HttpRequestParts {
    // Required methods
    fn value(
        &self,
        source: InputSource,
        name: &str,
        index: usize,
    ) -> Option<Cow<'_, str>>;
    fn body(&self) -> &[u8] ;

    // Provided methods
    fn take_body_stream(&self) -> Option<StreamingBody> { ... }
    fn extension(&self, _type_id: TypeId) -> Option<&dyn Any> { ... }
}
Expand description

Borrowed HTTP request values used by the compiled executor.

Production adapters implement this view over their native request without copying headers, query strings, or request bodies.

Required Methods§

Source

fn value( &self, source: InputSource, name: &str, index: usize, ) -> Option<Cow<'_, str>>

Source

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

Provided Methods§

Source

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

Transfers an adapter-owned pull request body to a streaming extractor.

Source

fn extension(&self, _type_id: TypeId) -> Option<&dyn Any>

Returns transport context installed by HTTP middleware.

The default keeps non-HTTP transports and existing adapters allocation free. HTTP adapters only allocate extension storage when middleware actually installs a value.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§