pub struct Mime(/* private fields */);

Implementations§

source§

impl Mime

source

pub fn from_extension(ext: &str) -> Option<Self>

Create a Mime Type from a file extension.

source

pub fn extension(&self) -> &'static str

source

pub fn as_str(&self) -> &'static str

source

pub fn as_str_with_maybe_charset(&self) -> &'static str

§

impl Mime

pub const TEXT: Self = _

File extensions: txt
mime types: text/plain

pub const HTML: Self = _

File extensions: html
mime types: text/html

pub const JS: Self = _

File extensions: js, mjs, cjs
mime types: application/javascript

pub const CSS: Self = _

File extensions: css
mime types: text/css

pub const JSON: Self = _

File extensions: json
mime types: application/json

pub const CSV: Self = _

File extensions: csv
mime types: text/csv

pub const DOC: Self = _

File extensions: doc
mime types: application/msword

pub const DOCX: Self = _

File extensions: docx
mime types: application/vnd.openxmlformats-officedocument.wordprocessingml.document

pub const PDF: Self = _

File extensions: pdf
mime types: application/pdf

pub const PHP: Self = _

File extensions: php
mime types: application/php

pub const RTF: Self = _

File extensions: rtf
mime types: application/rtf

pub const SH: Self = _

File extensions: sh
mime types: application/x-sh

pub const VSD: Self = _

File extensions: vsd
mime types: application/vnd.visio

pub const XML: Self = _

File extensions: xml
mime types: text/xml

pub const JPG: Self = _

File extensions: jpg
mime types: image/jpeg

pub const PNG: Self = _

File extensions: png
mime types: image/png

pub const GIF: Self = _

File extensions: gif
mime types: image/gif

pub const SVG: Self = _

File extensions: svg
mime types: image/svg+xml

pub const ICO: Self = _

File extensions: ico
mime types: image/vnd.microsoft.icon

pub const TIFF: Self = _

File extensions: tiff
mime types: image/tiff

pub const WBP: Self = _

File extensions: webp
mime types: image/webp

pub const EOT: Self = _

File extensions: eot
mime types: application/vnd.ms-fontobject

pub const TTF: Self = _

File extensions: ttf
mime types: font/ttf

pub const WOFF: Self = _

File extensions: woff
mime types: font/woff

pub const WOOF2: Self = _

File extensions: woff2
mime types: font/woff2

pub const AVI: Self = _

File extensions: avi
mime types: video/x-msvideo

pub const OGV: Self = _

File extensions: ogv
mime types: video/ogg

pub const WEBM: Self = _

File extensions: webm
mime types: video/webm

pub const MP4: Self = _

File extensions: mp4
mime types: video/mp4

pub const AAC: Self = _

File extensions: aac
mime types: audio/aac

pub const MP3: Self = _

File extensions: mp3
mime types: audio/mpeg

pub const OGA: Self = _

File extensions: oga
mime types: audio/ogg

pub const WAV: Self = _

File extensions: wav
mime types: audio/wav

pub const WEBA: Self = _

File extensions: weba
mime types: audio/webm

pub const RAR: Self = _

File extensions: rar
mime types: application/vnd.rar

pub const TAR: Self = _

File extensions: tar
mime types: application/x-tar

pub const ZIP: Self = _

File extensions: zip
mime types: application/zip

pub const _7ZIP: Self = _

File extensions: 7z
mime types: application/x-7z-compressed

pub const JAR: Self = _

File extensions: jar
mime types: application/java-archive

pub const BINARY: Self = _

File extensions: bin
mime types: application/octet-stream

pub const WASM: Self = _

File extensions: wasm
mime types: application/wasm

Trait Implementations§

source§

impl Clone for Mime

source§

fn clone(&self) -> Mime

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Mime

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for Mime

source§

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

Formats the value using the given formatter. Read more
source§

impl From<Mime> for ContentType

source§

fn from(m: Mime) -> Self

Converts to this type from the input type.
source§

impl FromStr for Mime

§

type Err = ()

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, ()>

Parses a string s to return a value of this type. Read more
source§

impl Hash for Mime

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Mime

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Mime

source§

impl Eq for Mime

source§

impl StructuralEq for Mime

source§

impl StructuralPartialEq for Mime

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.