neo-mime

Crates.ioneo-mime
lib.rsneo-mime
version0.1.1
sourcesrc
created_at2021-04-27 10:01:49.749261
updated_at2021-04-27 10:16:28.802443
descriptionStrongly Typed Mimes
homepage
repositoryhttps://github.com/morr0ne/neo-mime
max_upload_size
id390102
size58,836
Federico Maria Morrone (morr0ne)

documentation

https://docs.rs/neo-mime

README

Based on the apparently unmaintained mime crate

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: 244

cargo fmt