1 unstable release
0.0.0 | Jan 29, 2021 |
---|
#86 in #mime
Used in mime_4
48KB
1.5K
SLoC
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!
}
}
}
Dependencies
~2MB
~48K SLoC