[][src]Struct http_fs::StaticFiles

pub struct StaticFiles<C = DefaultConfig> { /* fields omitted */ }

Static files service

Methods

impl<C: StaticFileConfig> StaticFiles<C>[src]

pub fn new(config: C) -> Self[src]

Creates new instance with provided config

pub fn workers(&self) -> &ThreadPool[src]

Returns reference to thread pool

pub fn serve(&self, path: &Path) -> ServeEntry[src]

Serves file

pub fn handle_not_found(
    &self,
    path: &Path,
    out_headers: &mut HeaderMap
) -> (StatusCode, Bytes)
[src]

Handles not found directory

pub fn list_dir(&self, path: &Path, dir: ReadDir) -> Bytes[src]

Serve directory routine

pub fn serve_file(
    &self,
    path: &Path,
    file: File,
    meta: Metadata,
    method: Method,
    headers: &HeaderMap,
    out_headers: &mut HeaderMap
) -> (StatusCode, Option<ChunkedReadFile<C::FileService>>)
[src]

Serves file routine

Trait Implementations

impl Default for StaticFiles<DefaultConfig>[src]

impl<C: Clone> Clone for StaticFiles<C>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<C: StaticFileConfig> Service for StaticFiles<C>[src]

type ReqBody = Body

The Payload body of the http::Request.

type ResBody = Body

The Payload body of the http::Response.

type Error = Error

The error type that can occur within this Service. Read more

type Future = FutureResult<Response<Self::ResBody>, Self::Error>

The Future returned by this Service.

fn poll_ready(&mut self) -> Result<Async<()>, Self::Error>[src]

Returns Ready when the service is able to process requests. Read more

impl<C: StaticFileConfig + Clone, Ctx> MakeService<Ctx> for StaticFiles<C>[src]

type ReqBody = Body

The Payload body of the http::Request.

type ResBody = Body

The Payload body of the http::Response.

type Error = Error

The error type that can be returned by Services.

type Service = Self

The resolved Service from new_service().

type MakeError = Error

The error type that can be returned when creating a new Service.

type Future = FutureResult<Self::Service, Self::MakeError>

The future returned from new_service of a Service.

fn poll_ready(&mut self) -> Result<Async<()>, Self::MakeError>[src]

Returns Ready when the constructor is ready to create a new Service. Read more

Auto Trait Implementations

impl<C> Send for StaticFiles<C> where
    C: Send

impl<C> Unpin for StaticFiles<C> where
    C: Unpin

impl<C = DefaultConfig> !Sync for StaticFiles<C>

impl<C = DefaultConfig> !UnwindSafe for StaticFiles<C>

impl<C = DefaultConfig> !RefUnwindSafe for StaticFiles<C>

Blanket Implementations

impl<T> From<T> 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.

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

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

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

impl<T> Erased for T

impl<N, Ctx> MakeService<Ctx> for N where
    N: NewService
[src]

type ReqBody = <N as NewService>::ReqBody

The Payload body of the http::Request.

type ResBody = <N as NewService>::ResBody

The Payload body of the http::Response.

type Error = <N as NewService>::Error

The error type that can be returned by Services.

type Service = <N as NewService>::Service

The resolved Service from new_service().

type Future = <N as NewService>::Future

The future returned from new_service of a Service.

type MakeError = <N as NewService>::InitError

The error type that can be returned when creating a new Service.