Struct fire_http::header::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
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

§

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

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere 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 Twhere 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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere 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.
§

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

§

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