Struct hyper_staticfile::FileResponseBuilder[][src]

pub struct FileResponseBuilder {
    pub cache_headers: Option<u32>,
    pub is_head: bool,
    pub if_modified_since: Option<SystemTime>,
    pub range: Option<String>,
    pub if_range: Option<String>,
}
Expand description

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<SystemTime>

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

range: Option<String>

The file ranges to read, if any, otherwise we read from the beginning.

if_range: Option<String>

The unparsed value of the If-Range request header. May match etag or last-modified.

Implementations

Create a new builder with a default configuration.

Apply parameters based on a request.

Apply parameters based on request parts.

Apply parameters based on a request method.

Apply parameters based on request headers.

Add cache headers to responses for the given lifespan.

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

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

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

Build responses for the given If-Range request header value.

Build responses for the given Range request header value.

Build a response for the given file and metadata.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more