Trait rama::http::layer::set_header::MakeHeaderValue

pub trait MakeHeaderValue<S, T>: Send + Sync + 'static {
    // Required method
    fn make_header_value(
        &self,
        ctx: Context<S>,
        message: T,
    ) -> impl Future<Output = (Context<S>, T, 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§

fn make_header_value( &self, ctx: Context<S>, message: T, ) -> impl Future<Output = (Context<S>, T, 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<S, T> MakeHeaderValue<S, T> for Option<HeaderValue>
where S: Send + Sync + 'static, T: Send + 'static,

§

fn make_header_value( &self, ctx: Context<S>, message: T, ) -> impl Future<Output = (Context<S>, T, Option<HeaderValue>)> + Send

Implementors§

§

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

§

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