[][src]Struct octane::file_handler::FileHandler

pub struct FileHandler {
    pub file_name: String,
    pub file: AsyncReader<File>,
    pub extension: String,
    pub meta: Metadata,
}

The FileHandler structure is a helper struct to manage files, contents and extensions also to decide their mime types accordingly

Fields

file_name: Stringfile: AsyncReader<File>extension: Stringmeta: Metadata

Implementations

impl FileHandler[src]

pub fn handle_file(path: &PathBuf) -> Result<Self, Box<dyn Error>>[src]

Takes a Pathbuf and returns a FileHandler struct

pub fn get_extension(path: &PathBuf) -> String[src]

A helper method to get extension from a PathBuf

pub fn mime_type(extension: String) -> String[src]

Perform a match on the extension and return the mime type accordingly

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, 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.