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 3329719/week @ 2025-10-21 3407724/week @ 2025-10-28 3349858/week @ 2025-11-04 3271081/week @ 2025-11-11 3530292/week @ 2025-11-18 2858393/week @ 2025-11-25 3414801/week @ 2025-12-02 3756642/week @ 2025-12-09 3551508/week @ 2025-12-16 1996328/week @ 2025-12-23 2236618/week @ 2025-12-30 3866702/week @ 2026-01-06 4103202/week @ 2026-01-13 4557571/week @ 2026-01-20 4684192/week @ 2026-01-27 5082591/week @ 2026-02-03

19,152,485 downloads per month
Used in 25,193 crates (1,768 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