# MediaType MediaType for Rust [![Crates.io](https://img.shields.io/crates/v/mediatype.svg)](https://crates.io/crates/mediatype) [![GitHub license](https://img.shields.io/github/license/picoHz/mediatype.svg)](https://github.com/picoHz/mediatype/blob/main/LICENSE) [![Rustdoc](https://img.shields.io/badge/doc-rustdoc-green.svg)](https://docs.rs/mediatype) ![Rust](https://github.com/picoHz/mediatype/workflows/Rust/badge.svg)

This crate provides two MediaType structs: MediaType and MediaTypeBuf.

```rust use mediatype::{names::*, MediaType, MediaTypeBuf};

const TEXTPLAIN: MediaType = MediaType::new(TEXT, PLAIN); let textplain: MediaTypeBuf = "text/plain".parse().unwrap();

asserteq!(textplain, TEXT_PLAIN);

match (textplain.ty(), textplain.subty()) { ("text", "plain") => println!("plain text!"), ("text", _) => println!("structured text"), _ => println!("not text"), } ```