Crates.io | mime_4 |
lib.rs | mime_4 |
version | 0.4.0-a.0 |
source | src |
created_at | 2021-01-29 12:54:11.640634 |
updated_at | 2021-01-29 12:54:11.640634 |
description | Strongly Typed Mimes |
homepage | |
repository | https://github.com/hyperium/mime |
max_upload_size | |
id | 348042 |
size | 58,172 |
Support MIME (HTTP Media Types) as strong types in Rust.
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!
}
}
}