Trait Headers

Source
pub trait Headers<IntoResponseT>: Sized
where IntoResponseT: IntoResponse,
{ // Required methods fn with_duration(self, duration: Duration) -> Response; fn with_duration_str( self, duration: &str, ) -> Result<Response, InvalidHeaderValue>; fn set_header_bool(self, name: HeaderName, value: bool) -> Response; // Provided methods fn do_not_encode(self) -> Response { ... } fn do_not_cache(self) -> Response { ... } }
Available on crate feature axum only.
Expand description

Headers.

Required Methods§

Source

fn with_duration(self, duration: Duration) -> Response

Set XX-Cache-Duration header.

Source

fn with_duration_str( self, duration: &str, ) -> Result<Response, InvalidHeaderValue>

Set XX-Cache-Duration header.

Source

fn set_header_bool(self, name: HeaderName, value: bool) -> Response

Set a header to a boolean value.

Provided Methods§

Source

fn do_not_encode(self) -> Response

Set XX-Encode header to “false”.

Source

fn do_not_cache(self) -> Response

Set XX-Cache header to “false”.

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.

Implementors§

Source§

impl<IntoResponseT> Headers<IntoResponseT> for IntoResponseT
where IntoResponseT: IntoResponse,