[−][src]Struct hyper_staticfile::FileResponseBuilder
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 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][−]
&mut self,
method: &Method,
headers: &HeaderMap
) -> &mut Self
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][−]
&mut self,
value: Option<DateTime<LocalTz>>
) -> &mut Self
Build responses for the given If-Modified-Since
date-time.
pub fn if_modified_since_header(
&mut self,
value: Option<&HeaderValue>
) -> &mut Self
[src][−]
&mut self,
value: Option<&HeaderValue>
) -> &mut Self
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
impl RefUnwindSafe for FileResponseBuilder
impl Send for FileResponseBuilder
impl Sync for FileResponseBuilder
impl Unpin for FileResponseBuilder
impl UnwindSafe for FileResponseBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,