Trait trillium_caching_headers::CachingHeadersExt[][src]

pub trait CachingHeadersExt: Sized {
Show 13 methods fn etag(&self) -> Option<EntityTag>;
fn set_etag(&mut self, entity_tag: &EntityTag);
fn last_modified(&self) -> Option<SystemTime>;
fn set_last_modified(&mut self, system_time: SystemTime);
fn cache_control(&self) -> Option<CacheControlHeader>;
fn set_cache_control(
        &mut self,
        cache_control: impl Into<CacheControlHeader>
    );
fn if_modified_since(&self) -> Option<SystemTime>;
fn if_none_match(&self) -> Option<EntityTag>;
fn set_vary<I, N>(&mut self, vary: I)
    where
        I: IntoIterator<Item = N>,
        N: Into<HeaderName<'static>>
; fn with_cache_control(
        self,
        cache_control: impl Into<CacheControlHeader>
    ) -> Self { ... }
fn with_last_modified(self, system_time: SystemTime) -> Self { ... }
fn with_etag(self, entity_tag: &EntityTag) -> Self { ... }
fn with_vary<I, N>(self, vary: I) -> Self
    where
        I: IntoIterator<Item = N>,
        N: Into<HeaderName<'static>>
, { ... }
}
Expand description

Provides an extension trait for both [trillium::Headers] and also trillium::Conn for setting and getting various parsed caching headers.

Required methods

returns an EntityTag if these headers contain an Etag header.

sets an etag header from an EntityTag.

returns a parsed timestamp if these headers contain a Last-Modified header.

sets a formatted Last-Modified header from a timestamp.

returns a parsed CacheControlHeader if these headers include a Cache-Control header. Note that if this is called on a [Conn], it returns the request [Cache-Control] header.

sets a Cache-Control header on these headers. Note that this is valid in both request and response contexts, and specific directives have different meanings.

returns a parsed If-Modified-Since header if one exists

returns a parsed EntityTag header if there is an If-None-Match header.

sets the Vary header to a collection of Into

Provided methods

chainable method to set cache control and return self. primarily useful on Conn

chainable method to set last modified and return self. primarily useful on Conn

chainable method to set etag and return self. primarily useful on Conn

chainable method to set vary and return self. primarily useful on Conn

Implementations on Foreign Types

Implementors