mirror of
https://gitee.com/openharmony/third_party_rust_mime
synced 2024-11-23 13:09:43 +00:00
ba9f1206d3
Put the result in an underscore variable so the compiler doesn't complain that it is unused. |
||
---|---|---|
benches | ||
src | ||
.gitignore | ||
.travis.yml | ||
Cargo.toml | ||
CONTRIBUTING.md | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
mime
Support MIME (Media Types) as strong types in Rust.
Usage
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!
}
}