Crates.io | mime |
lib.rs | mime |
version | 0.3.17 |
source | src |
created_at | 2014-11-20 08:33:46.22482 |
updated_at | 2023-03-20 15:05:04.272177 |
description | Strongly Typed Mimes |
homepage | |
repository | https://github.com/hyperium/mime |
max_upload_size | |
id | 121 |
size | 57,459 |
Support MIME (Media Types) as strong types in Rust.
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!
}
}