[][src]Struct hyper_staticfile::ResponseBuilder

pub struct ResponseBuilder<'a> {
    pub path: &'a str,
    pub query: Option<&'a str>,
    pub file_response_builder: FileResponseBuilder,
}

Utility to build the default response for a resolve result.

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

path: &'a str

The request path.

query: Option<&'a str>

The request query string.

file_response_builder: FileResponseBuilder

Inner file response builder.

Implementations

impl<'a> ResponseBuilder<'a>[src]

pub fn new() -> Self[src]

Create a new builder with a default configuration.

pub fn request<B>(&mut self, req: &'a Request<B>) -> &mut Self[src]

Apply parameters based on a request.

pub fn request_parts(
    &mut self,
    method: &Method,
    uri: &'a Uri,
    headers: &'a HeaderMap
) -> &mut Self
[src]

Apply parameters based on request parts.

pub fn request_uri(&mut self, uri: &'a Uri) -> &mut Self[src]

Apply parameters based on a request URI.

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

Add cache headers to responses for the given lifespan.

pub fn path(&mut self, value: &'a str) -> &mut Self[src]

Set the request path.

pub fn query(&mut self, value: Option<&'a str>) -> &mut Self[src]

Set the request query string.

pub fn build(&self, result: ResolveResult) -> Result<Response<Body>>[src]

Build a response for the given request and resolve result.

This function may error if it response could not be constructed, but this should be a seldom occurrence.

Trait Implementations

impl<'a> Clone for ResponseBuilder<'a>[src]

impl<'a> Debug for ResponseBuilder<'a>[src]

impl<'a> Default for ResponseBuilder<'a>[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.