Crates.io | neo-mime |
lib.rs | neo-mime |
version | 0.1.1 |
source | src |
created_at | 2021-04-27 10:01:49.749261 |
updated_at | 2021-04-27 10:16:28.802443 |
description | Strongly Typed Mimes |
homepage | |
repository | https://github.com/morr0ne/neo-mime |
max_upload_size | |
id | 390102 |
size | 58,836 |
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!
}
}
}