#[non_exhaustive]
pub enum Mime {
Show 41 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

Returns the file extension.

Note

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

Returns the mime type.

Note

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

Returns the type.

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

Returns the subtype.

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

Tries to return a mime type from a file extension.

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

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Converts to this type from the input type.

Converts to this type from the input type.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.