[][src]Struct hyper_staticfile::FileResponseBuilder

pub struct FileResponseBuilder {
    pub cache_headers: Option<u32>,
    pub is_head: bool,
    pub if_modified_since: Option<DateTime<LocalTz>>,
}

Utility to build responses for serving a tokio::fs::File.

This struct allows direct access to its fields, but these fields are typically initialized by the accessors, using the builder pattern. The fields are basically a bunch of settings that determine the response details.

Fields

cache_headers: Option<u32>

Whether to send cache headers, and what lifespan to indicate.

is_head: bool

Whether this is a HEAD request, with no response body.

if_modified_since: Option<DateTime<LocalTz>>

The parsed value of the If-Modified-Since request header.

Implementations

impl FileResponseBuilder[src]

pub fn new() -> Self[src]

Create a new builder with a default configuration.

pub fn request<B>(&mut self, req: &Request<B>) -> &mut Self[src]

Apply parameters based on a request.

pub fn request_parts(
    &mut self,
    method: &Method,
    headers: &HeaderMap
) -> &mut Self
[src]

Apply parameters based on request parts.

pub fn request_method(&mut self, method: &Method) -> &mut Self[src]

Apply parameters based on a request method.

pub fn request_headers(&mut self, headers: &HeaderMap) -> &mut Self[src]

Apply parameters based on request headers.

pub fn cache_headers(&mut self, value: Option<u32>) -> &mut Self[src]

Add cache headers to responses for the given lifespan.

pub fn is_head(&mut self, value: bool) -> &mut Self[src]

Set whether this is a HEAD request, with no response body.

pub fn if_modified_since(
    &mut self,
    value: Option<DateTime<LocalTz>>
) -> &mut Self
[src]

Build responses for the given If-Modified-Since date-time.

pub fn if_modified_since_header(
    &mut self,
    value: Option<&HeaderValue>
) -> &mut Self
[src]

Build responses for the given If-Modified-Since request header value.

pub fn build(&self, file: File, metadata: Metadata) -> Result<Response<Body>>[src]

Build a response for the given file and metadata.

Trait Implementations

impl Clone for FileResponseBuilder[src]

impl Debug for FileResponseBuilder[src]

impl Default for FileResponseBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.