pub trait Headers<IntoResponseT>: Sizedwhere
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§
Sourcefn with_duration(self, duration: Duration) -> Response
fn with_duration(self, duration: Duration) -> Response
Set XX-Cache-Duration header.
Sourcefn with_duration_str(
self,
duration: &str,
) -> Result<Response, InvalidHeaderValue>
fn with_duration_str( self, duration: &str, ) -> Result<Response, InvalidHeaderValue>
Set XX-Cache-Duration header.
Sourcefn set_header_bool(self, name: HeaderName, value: bool) -> Response
fn set_header_bool(self, name: HeaderName, value: bool) -> Response
Set a header to a boolean value.
Provided Methods§
Sourcefn do_not_encode(self) -> Response
fn do_not_encode(self) -> Response
Set XX-Encode header to “false”.
Sourcefn do_not_cache(self) -> Response
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.