Struct hyper_staticfile::FileResponseBuilder [−][src]
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]
impl FileResponseBuilderpub fn new() -> Self[src]
pub fn new() -> SelfCreate a new builder with a default configuration.
pub fn from_request<B>(req: &Request<B>) -> Self[src]
pub fn from_request<B>(req: &Request<B>) -> SelfCreate a new builder for the given request.
pub fn cache_headers(&mut self, value: Option<u32>) -> &mut Self[src]
pub fn cache_headers(&mut self, value: Option<u32>) -> &mut SelfAdd cache headers to responses for the given lifespan.
pub fn method(&mut self, value: &Method) -> &mut Self[src]
pub fn method(&mut self, value: &Method) -> &mut SelfBuild responses for the given request method.
pub fn if_modified_since_header(
&mut self,
value: Option<&HeaderValue>
) -> &mut Self[src]
pub fn if_modified_since_header(
&mut self,
value: Option<&HeaderValue>
) -> &mut SelfBuild responses for the given If-Modified-Since request header value.
pub fn build(&self, file: File, metadata: Metadata) -> Result<Response<Body>>[src]
pub fn build(&self, file: File, metadata: Metadata) -> Result<Response<Body>>Build a response for the given file and metadata.
Trait Implementations
impl Clone for FileResponseBuilder[src]
impl Clone for FileResponseBuilderfn clone(&self) -> FileResponseBuilder[src]
fn clone(&self) -> FileResponseBuilderReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for FileResponseBuilder[src]
impl Debug for FileResponseBuilderfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Default for FileResponseBuilder[src]
impl Default for FileResponseBuilderfn default() -> FileResponseBuilder[src]
fn default() -> FileResponseBuilderReturns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for FileResponseBuilder
impl Send for FileResponseBuilderimpl Sync for FileResponseBuilder
impl Sync for FileResponseBuilder