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: 2 days 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 (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-10-31T10:17:05.000Z (13 days ago)
- Last Synced: 2024-11-08T16:54:06.340Z (5 days ago)
- Language: Rust
- Homepage: https://docs.rs/mime
- Size: 815 KB
- Stars: 177
- Watchers: 8
- Forks: 78
- Open Issues: 44
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# mime
[![Build Status](https://travis-ci.org/hyperium/mime.svg?branch=master)](https://travis-ci.org/hyperium/mime)
[![crates.io](https://img.shields.io/crates/v/mime.svg)](https://crates.io/crates/mime)
[![docs.rs](https://docs.rs/mime/badge.svg)](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!
}
}
}
```