rama::http::layer::set_header::response

Trait MakeHeaderValue

pub trait MakeHeaderValue<B>:
    Send
    + Sync
    + 'static {
    // Required method
    fn make_header_value(
        self,
        response: Response<B>,
    ) -> impl Future<Output = (Response<B>, Option<HeaderValue>)> + Send;
}
Expand description

Trait for producing header values, created by a MakeHeaderValueFactory.

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§

fn make_header_value( self, response: Response<B>, ) -> impl Future<Output = (Response<B>, Option<HeaderValue>)> + Send

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<B, M> MakeHeaderValue<B> for Option<M>
where M: MakeHeaderValue<B> + Clone, B: Send + 'static,

§

async fn make_header_value( self, response: Response<B>, ) -> (Response<B>, Option<HeaderValue>)

Implementors§

§

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

§

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