This crate provides two MediaType structs:
MediaType
and
MediaTypeBuf
.
MediaType
does not copy data during parsing
and just holds reference to the original string. It is also const-constructible.MediaTypeBuf
is an owned and immutable version of MediaType
.```rust use mediatype::{names::*, MediaType, MediaTypeBuf};
const TEXTPLAIN: MediaType = MediaType::new(TEXT, PLAIN); let textplain: MediaTypeBuf = "text/plain".parse().unwrap();
asserteq!(textplain, TEXT_PLAIN); ```