MIME types for Rust, vendored from https://github.com/hyperium/mime
- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| benches | ||
| mime-macro | ||
| mime-parse | ||
| src | ||
| .gitignore | ||
| .travis.yml | ||
| Cargo.toml | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| README.md | ||
mime
Support MIME (HTTP Media Types) as strong types in Rust.
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!
}
}
}