2 releases

0.1.1 Apr 27, 2021
0.1.0 Apr 27, 2021

#31 in #strong

23 downloads per month
Used in neo-mime

MIT license

48KB
1.5K SLoC

Based on the apparently unmaintained mime crate

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

Dependencies

~1.5MB
~33K SLoC