Skip to main content

Mime

Struct Mime 

Source
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 duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Mime

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 Eq for Mime

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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Mime

Auto Trait Implementations§

§

impl Freeze for Mime

§

impl RefUnwindSafe for Mime

§

impl Send for Mime

§

impl Sync for Mime

§

impl Unpin for Mime

§

impl UnsafeUnpin 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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§

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

Source§

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

Source§

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.