[][src]Struct http_fs::file::ServeFile

pub struct ServeFile<C = DefaultConfig> {
    pub content_type: Mime,
    pub content_disposition: ContentDisposition,
    // some fields omitted
}

File service helper

Fields

content_type: Mime

File's MIME type

content_disposition: ContentDisposition

File's Content-Disposition

Methods

impl ServeFile<DefaultConfig>[src]

pub fn from_parts(file_name: &str, file: File, meta: Metadata) -> Self[src]

Creates new instance from already opened file

impl<C: FileServeConfig> ServeFile<C>[src]

pub fn open(path: &Path) -> Result<Self>[src]

Opens file to serve.

pub fn from_parts_with_cfg(file_name: &str, file: File, meta: Metadata) -> Self[src]

Creates new instance from already opened file

pub fn etag(&self) -> EntityTag[src]

Creates EntityTag for file

pub fn last_modified(&self) -> Option<HttpDate>[src]

Creates HttpDate instance for file, if possible

pub fn len(&self) -> u64[src]

Returns length of File.

pub fn prepare(
    self,
    path: &Path,
    method: Method,
    headers: &HeaderMap,
    out_headers: &mut HeaderMap,
    workers: &ThreadPool
) -> (StatusCode, Option<ChunkedReadFile<C>>)
[src]

Prepares file for service

Trait Implementations

impl<C> Into<File> for ServeFile<C>[src]

Auto Trait Implementations

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

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

impl<C> Sync for ServeFile<C> where
    C: Sync

impl<C> UnwindSafe for ServeFile<C> where
    C: UnwindSafe

impl<C> RefUnwindSafe for ServeFile<C> where
    C: RefUnwindSafe

Blanket Implementations

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

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

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