Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyperium/mime
MIMEs in Rust
https://github.com/hyperium/mime
Last synced: 1 day ago
JSON representation
MIMEs in Rust
- Host: GitHub
- URL: https://github.com/hyperium/mime
- Owner: hyperium
- License: mit
- Created: 2014-08-27T17:29:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-10-31T10:17:05.000Z (4 months ago)
- Last Synced: 2025-02-13T13:05:43.152Z (8 days ago)
- Language: Rust
- Homepage: https://docs.rs/mime
- Size: 815 KB
- Stars: 187
- Watchers: 8
- Forks: 79
- Open Issues: 47
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# mime
[](https://travis-ci.org/hyperium/mime)
[](https://crates.io/crates/mime)
[](https://docs.rs/mime)Support MIME (HTTP Media Types) as strong types in Rust.
[Documentation](https://docs.rs/mime)
## Usage
```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!
}
}
}
```