Struct Mime

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

Implementations§

Source§

impl Mime

Source

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

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

Source§

impl Mime

Source

pub const TEXT: Mime

File extensions: txt
mime types: text/plain

Source

pub const HTML: Mime

File extensions: html
mime types: text/html

Source

pub const JS: Mime

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

Source

pub const CSS: Mime

File extensions: css
mime types: text/css

Source

pub const JSON: Mime

File extensions: json
mime types: application/json

Source

pub const CSV: Mime

File extensions: csv
mime types: text/csv

Source

pub const DOC: Mime

File extensions: doc
mime types: application/msword

Source

pub const DOCX: Mime

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

Source

pub const PDF: Mime

File extensions: pdf
mime types: application/pdf

Source

pub const PHP: Mime

File extensions: php
mime types: application/php

Source

pub const RTF: Mime

File extensions: rtf
mime types: application/rtf

Source

pub const SH: Mime

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

Source

pub const VSD: Mime

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

Source

pub const XML: Mime

File extensions: xml
mime types: text/xml

Source

pub const JPG: Mime

File extensions: jpg
mime types: image/jpeg

Source

pub const PNG: Mime

File extensions: png
mime types: image/png

Source

pub const GIF: Mime

File extensions: gif
mime types: image/gif

Source

pub const SVG: Mime

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

Source

pub const ICO: Mime

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

Source

pub const TIFF: Mime

File extensions: tiff
mime types: image/tiff

Source

pub const WBP: Mime

File extensions: webp
mime types: image/webp

Source

pub const EOT: Mime

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

Source

pub const TTF: Mime

File extensions: ttf
mime types: font/ttf

Source

pub const WOFF: Mime

File extensions: woff
mime types: font/woff

Source

pub const WOOF2: Mime

File extensions: woff2
mime types: font/woff2

Source

pub const AVI: Mime

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

Source

pub const OGV: Mime

File extensions: ogv
mime types: video/ogg

Source

pub const WEBM: Mime

File extensions: webm
mime types: video/webm

Source

pub const MP4: Mime

File extensions: mp4
mime types: video/mp4

Source

pub const AAC: Mime

File extensions: aac
mime types: audio/aac

Source

pub const MP3: Mime

File extensions: mp3
mime types: audio/mpeg

Source

pub const OGA: Mime

File extensions: oga
mime types: audio/ogg

Source

pub const WAV: Mime

File extensions: wav
mime types: audio/wav

Source

pub const WEBA: Mime

File extensions: weba
mime types: audio/webm

Source

pub const RAR: Mime

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

Source

pub const TAR: Mime

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

Source

pub const ZIP: Mime

File extensions: zip
mime types: application/zip

Source

pub const _7ZIP: Mime

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

Source

pub const JAR: Mime

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

Source

pub const BINARY: Mime

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

Source

pub const WASM: Mime

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<(), Error>

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

impl Display for Mime

Source§

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

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

impl From<Mime> for ContentType

Source§

fn from(m: Mime) -> ContentType

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<Mime, ()>

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

impl Hash for Mime

Source§

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

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 · 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 Copy for Mime

Source§

impl Eq for Mime

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 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,