[][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.

Methods

impl FileResponseBuilder[src]

pub fn new() -> Self[src]

Create a new builder with a default configuration.

pub fn from_request<B>(req: &Request<B>) -> Self[src]

Create a new builder for the given request.

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

Add cache headers to responses for the given lifespan.

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

Build responses for the given request method.

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 Default for FileResponseBuilder[src]

impl Clone for FileResponseBuilder[src]

impl Debug for FileResponseBuilder[src]

Auto Trait Implementations

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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

impl<T> Erased for T