[−][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 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]
&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 Default for FileResponseBuilder
[src]
fn default() -> FileResponseBuilder
[src]
impl Clone for FileResponseBuilder
[src]
fn clone(&self) -> FileResponseBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FileResponseBuilder
[src]
Auto Trait Implementations
impl Send for FileResponseBuilder
impl Unpin for FileResponseBuilder
impl Sync for FileResponseBuilder
impl UnwindSafe for FileResponseBuilder
impl RefUnwindSafe for FileResponseBuilder
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,