MediaType
MIME Media-type parsing for Rust
This crate provides two MediaType structs:
MediaType and
MediaTypeBuf.
MediaType
This does not copy data during parsing and borrows the original string. It is also const-constructible.
use ;
let mut multipart = new;
let boundary = new.unwrap;
multipart.set_param;
assert_eq!;
multipart.subty = RELATED;
assert_eq!;
const IMAGE_SVG: MediaType = from_parts;
let svg = parse.unwrap;
assert_eq!;
MediaTypeBuf
This is an owned and immutable version of MediaType.
use ;
let text_plain: MediaTypeBuf = "text/plain; charset=UTF-8".parse.unwrap;
assert_eq!;
let mut text_plain: MediaType = text_plain.to_ref;
text_plain.subty = MARKDOWN;
assert_eq!;