Skip to content

hyperium/mime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1ef137c · Oct 31, 2024
Jan 17, 2019
Jan 15, 2019
Dec 16, 2019
Oct 31, 2024
Aug 27, 2014
Jan 12, 2019
Dec 28, 2018
Jan 17, 2019
Dec 28, 2018
Jan 15, 2019

Repository files navigation

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!
        }
    }
}