Enum fire_http_representation::header::Mime[][src]

#[non_exhaustive]
pub enum Mime {
Show variants Text, Html, Js, Css, Json, Csv, Doc, Docx, Pdf, Php, Rtf, Sh, Vsd, Xml, Jpg, Png, Gif, Svg, Ico, Tiff, Webp, Eot, Ttf, Woff, Woff2, Avi, Ogv, Webm, Mp4, Aac, Mp3, Oga, Wav, Weba, Rar, Tar, Zip, _7Zip, Jar, Binary, Wasm,
}
Expand description

A list of the most important mime types.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text

File extension: txt, mime type: text/plain

Html

File extension: html, mime type: text/html

Js

File extension: js, mime type: application/javascript

Css

File extension: css, mime type: text/css

Json

File extension: json, mime type: application/json

Csv

File extension: csv, mime type: text/csv

Doc

File extension: doc, mime type: application/msword

Docx

File extension: docx, mime type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

Pdf

File extension: pdf, mime type: application/pdf

Php

File extension: php, mime type: application/php

Rtf

File extension: rtf, mime type: application/rtf

Sh

File extension: sh, mime type: application/x-sh

Vsd

File extension: vsd, mime type: application/vnd.visio

Xml

File extension: xml, mime type: text/xml

Jpg

File extension: jpg, mime type: image/jpeg

Png

File extension: png, mime type: image/png

Gif

File extension: gif, mime type: image/gif

Svg

File extension: svg, mime type: image/svg+xml

Ico

File extension: ico, mime type: image/vnd.microsoft.icon

Tiff

File extension: tiff, mime type: image/tiff

Webp

File extension: webp, mime type: image/webp

Eot

File extension: eot, mime type: application/vnd.ms-fontobject

Ttf

File extension: ttf, mime type: font/ttf

Woff

File extension: woff, mime type: font/woff

Woff2

File extension: woff2, mime type: font/woff2

Avi

File extension: avi, mime type: video/x-msvideo

Ogv

File extension: ogv, mime type: video/ogg

Webm

File extension: webm, mime type: video/webm

Mp4

File extension: mp4, mime type: video/mp4

Aac

File extension: aac, mime type: audio/aac

Mp3

File extension: mp3, mime type: audio/mpeg

Oga

File extension: oga, mime type: audio/ogg

Wav

File extension: wav, mime type: audio/wav

Weba

File extension: weba, mime type: audio/webm

Rar

File extension: rar, mime type: application/vnd.rar

Tar

File extension: tar, mime type: application/x-tar

Zip

File extension: zip, mime type: application/zip

_7Zip

File extension: 7z, mime type: application/x-7z-compressed

Jar

File extension: jar, mime type: application/java-archive

Binary

File extension: bin, mime type: application/octet-stream

Wasm

File extension: wasm, mime type: application/wasm

Implementations

impl Mime[src]

pub fn ext(&self) -> &'static str[src]

Returns the file extension.

Note

To see what mime type is returned see the variant documentation.

pub fn mime(&self) -> &'static str[src]

Returns the mime type.

Note

To see what mime type is returned see the variant documentation.

pub fn main_type(&self) -> &'static str[src]

Returns the type.

Example

let mime = Mime::Jar;
assert_eq!(mime.main_type(), "application");

pub fn sub_type(&self) -> &'static str[src]

Returns the subtype.

Example

let mime = Mime::Jar;
assert_eq!(mime.sub_type(), "java-archive");

pub fn try_from_ext(value: &str) -> Option<Self>[src]

Tries to return a mime type from a file extension.

pub fn from_ext(value: &str) -> Self[src]

Returns a mime type to a given file extension, if the file extension is unknown Mime::Binary is returned.

pub fn try_from_mime(value: &str) -> Option<Self>[src]

Tries to return a mime type from a mime type string.

Trait Implementations

impl Clone for Mime[src]

fn clone(&self) -> Mime[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Mime[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Mime[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl From<&'_ str> for Mime[src]

fn from(s: &str) -> Self[src]

Performs the conversion.

impl From<Mime> for AnyMime[src]

fn from(mime: Mime) -> Self[src]

Performs the conversion.

impl PartialEq<Mime> for Mime[src]

fn eq(&self, other: &Mime) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Copy for Mime[src]

impl Eq for Mime[src]

impl StructuralEq for Mime[src]

impl StructuralPartialEq for Mime[src]

Auto Trait Implementations

impl RefUnwindSafe for Mime

impl Send for Mime

impl Sync for Mime

impl Unpin for Mime

impl UnwindSafe for Mime

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.