38 releases

Uses old Rust 2015

0.3.17 Mar 20, 2023
0.3.16 Jan 7, 2020
0.3.14 Sep 9, 2019
0.3.13 Jan 11, 2019
0.0.1 Nov 20, 2014

#1 in Multimedia

Download history 3866702/week @ 2026-01-06 4103202/week @ 2026-01-13 4557571/week @ 2026-01-20 4684192/week @ 2026-01-27 5082638/week @ 2026-02-03 5143460/week @ 2026-02-10 5115877/week @ 2026-02-17 5486593/week @ 2026-02-24 6426344/week @ 2026-03-03 6504029/week @ 2026-03-10 6057962/week @ 2026-03-17 5803165/week @ 2026-03-24 5949114/week @ 2026-03-31 6407354/week @ 2026-04-07 6552595/week @ 2026-04-14 6701290/week @ 2026-04-21

26,629,986 downloads per month
Used in 29,554 crates (1,841 directly)

MIT/Apache

43KB
1K SLoC

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"),
}

mime

Build Status crates.io docs.rs

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

Documentation

Usage

extern crate mime;

// 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!
    }
}

No runtime deps