rama_http::layer::set_header::request

Trait MakeHeaderValue

Source
pub trait MakeHeaderValue<S, B>:
    Send
    + Sync
    + 'static {
    // Required method
    fn make_header_value(
        &self,
        ctx: Context<S>,
        req: Request<B>,
    ) -> impl Future<Output = (Context<S>, Request<B>, Option<HeaderValue>)> + Send + '_;
}
Expand description

Trait for producing header values.

Used by [SetRequestHeader] and [SetResponseHeader].

This trait is implemented for closures with the correct type signature. Typically users will not have to implement this trait for their own types.

It is also implemented directly for HeaderValue. When a fixed header value should be added to all responses, it can be supplied directly to the middleware.

Required Methods§

Source

fn make_header_value( &self, ctx: Context<S>, req: Request<B>, ) -> impl Future<Output = (Context<S>, Request<B>, Option<HeaderValue>)> + Send + '_

Try to create a header value from the request or response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S, B> MakeHeaderValue<S, B> for Option<HeaderValue>
where S: Clone + Send + Sync + 'static, B: Send + 'static,

Source§

fn make_header_value( &self, ctx: Context<S>, req: Request<B>, ) -> impl Future<Output = (Context<S>, Request<B>, Option<HeaderValue>)> + Send + '_

Implementors§

Source§

impl<S, B> MakeHeaderValue<S, B> for HeaderValue
where S: Clone + Send + Sync + 'static, B: Send + 'static,

Source§

impl<S, B, A, F> MakeHeaderValue<S, B> for BoxMakeHeaderValueFn<F, A>
where A: Send + 'static, F: MakeHeaderValueFn<S, B, A>,