Debian Codegraph @

third_party/rust/mime/README.md

raw
1 # mime
2
3 [![Build Status](https://travis-ci.org/hyperium/mime.svg?branch=master)](https://travis-ci.org/hyperium/mime)
4 [![crates.io](https://img.shields.io/crates/v/mime.svg)](https://crates.io/crates/mime)
5 [![docs.rs](https://docs.rs/mime/badge.svg)](https://docs.rs/mime)
6
7 Support MIME (Media Types) as strong types in Rust.
8
9 [Documentation](https://docs.rs/mime)
10
11 ## Usage
12
13 ```rust
14 extern crate mime;
15
16 // common types are constants
17 let text = mime::TEXT_PLAIN;
18
19 // deconstruct Mimes to match on them
20 match (text.type_(), text.subtype()) {
21 (mime::TEXT, mime::PLAIN) => {
22 // plain text!
23 },
24 (mime::TEXT, _) => {
25 // structured text!
26 },
27 _ => {
28 // not text!
29 }
30 }
31 ```