Crate mime[][src]

Mime

Mime is now Media Type, technically, but Mime is more immediately understandable, so the main type here is Mime.

What is Mime?

Example mime string: text/plain

let plain_text: mime::Mime = "text/plain".parse().unwrap();
assert_eq!(plain_text, mime::TEXT_PLAIN);

Inspecting Mimes

let mime = mime::TEXT_PLAIN;
match (mime.type_(), mime.subtype()) {
    (mime::TEXT, mime::PLAIN) => println!("plain text!"),
    (mime::TEXT, _) => println!("structured text"),
    _ => println!("not text"),
}

Structs

FromStrError

An error when parsing a Mime from a string.

Mime

A parsed mime or media type.

Name

A section of a Mime.

Params

An iterator over the parameters of a MIME.

Constants

APPLICATION

application

APPLICATION_JAVASCRIPT

application/javascript

APPLICATION_JAVASCRIPT_UTF_8

application/javascript; charset=utf-8

APPLICATION_JSON

application/json

APPLICATION_MSGPACK

application/msgpack

APPLICATION_OCTET_STREAM

application/octet-stream

APPLICATION_WWW_FORM_URLENCODED

application/x-www-form-urlencoded

AUDIO

audio

BASIC

basic

BMP

bmp

BOUNDARY

boundary

CHARSET

charset

CSS

css

CSV

csv

EVENT_STREAM

event-stream

FONT

font

FORM_DATA

form-data

GIF

gif

HTML

html

IMAGE

image

IMAGE_BMP

image/bmp

IMAGE_GIF

image/gif

IMAGE_JPEG

image/jpeg

IMAGE_PNG

image/png

IMAGE_STAR

image/*

IMAGE_SVG

image/svg+xml

JAVASCRIPT

javascript

JPEG

jpeg

JSON

json

MESSAGE

message

MODEL

model

MP4

mp4

MPEG

mpeg

MSGPACK

msgpack

MULTIPART

multipart

MULTIPART_FORM_DATA

multipart/form-data

OCTET_STREAM

octet-stream

OGG

ogg

PLAIN

plain

PNG

png

STAR
STAR_STAR

*/*

TEXT

text

TEXT_CSS

text/css

TEXT_CSV

text/csv

TEXT_CSV_UTF_8

text/csv; charset=utf-8

TEXT_EVENT_STREAM

text/event-stream

TEXT_HTML

text/html

TEXT_HTML_UTF_8

text/html; charset=utf-8

TEXT_JAVASCRIPT

text/javascript

TEXT_PLAIN

text/plain

TEXT_PLAIN_UTF_8

text/plain; charset=utf-8

TEXT_STAR

text/*

TEXT_TAB_SEPARATED_VALUES

text/tab-separated-values

TEXT_TAB_SEPARATED_VALUES_UTF_8

text/tab-separated-values; charset=utf-8

TEXT_XML

text/xml

UTF_8

utf-8

VIDEO

video

WWW_FORM_URLENCODED

x-www-form-urlencoded

XML

xml