Go to file
Rasmus Kaj ba9f1206d3 Fix test_mimes_macro_consts. (#87)
Put the result in an underscore variable so the compiler doesn't
complain that it is unused.
2018-06-30 13:46:08 -07:00
benches get type and subtype matching working 2017-06-07 12:27:41 -07:00
src Fix test_mimes_macro_consts. (#87) 2018-06-30 13:46:08 -07:00
.gitignore init 2014-08-27 10:30:13 -07:00
.travis.yml clean up between cargo build and cargo test in CI 2017-09-19 12:17:41 -07:00
Cargo.toml v0.3.7 2018-05-04 12:50:11 -07:00
CONTRIBUTING.md update readme with badges, move contribution to separate file 2017-09-19 11:50:28 -07:00
LICENSE-APACHE relicense as MIT/Apache-2.0 2017-06-07 12:31:14 -07:00
LICENSE-MIT relicense as MIT/Apache-2.0 2017-06-07 12:31:14 -07:00
README.md add a usage example to README 2017-09-19 11:58:29 -07:00

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