mime_4

Crates.iomime_4
lib.rsmime_4
version0.4.0-a.0
sourcesrc
created_at2021-01-29 12:54:11.640634
updated_at2021-01-29 12:54:11.640634
descriptionStrongly Typed Mimes
homepage
repositoryhttps://github.com/hyperium/mime
max_upload_size
id348042
size58,172
Sam Denty (samdenty)

documentation

https://docs.rs/mime

README

mime

Build Status crates.io docs.rs

Support MIME (HTTP Media Types) as strong types in Rust.

Documentation

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!
        }
    }
}
Commit count: 232

cargo fmt