MIME types for Rust, vendored from https://github.com/hyperium/mime
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Balazs Horvath f12477d1e9 chore(deps): migrate path dependencies to git URLs
Replace local mime-macro and mime-parse paths with git URLs
2026-05-22 21:52:16 +02:00
benches optimize cmp of multiple parameters 2019-01-17 09:55:27 -08:00
mime-macro make more things in mime-parse private 2019-01-15 11:48:32 -08:00
mime-parse Change deprecated range syntax 2019-12-16 10:46:39 -08:00
src Export Mime unconditionally 2026-05-22 10:05:31 +02:00
.gitignore init 2014-08-27 10:30:13 -07:00
.travis.yml fix mime_parse tests, run test --all in CI 2019-01-11 16:19:52 -08:00
Cargo.toml chore(deps): migrate path dependencies to git URLs 2026-05-22 21:52:16 +02:00
CONTRIBUTING.md media_type procedural macro 2018-12-28 10:43:17 -08:00
LICENSE relicense as just MIT 2018-12-28 10:43:17 -08:00
README.md clarify that the main context is HTTP MIME types 2019-01-15 13:23:25 -08:00

mime

Build Status crates.io docs.rs

Support MIME (HTTP Media Types) as strong types in Rust.

Documentation

Usage

extern crate mime;

fn main() {
    // common types are constants
    let text = mime::TEXT_PLAIN;

    // deconstruct Mimes to match on them
    match (text.type_(), text.subtype()) {
        (mime::TEXT, mime::PLAIN) => {
            // plain text!
        },
        (mime::TEXT, _) => {
            // structured text!
        },
        _ => {
            // not text!
        }
    }
}