Macro mediatype::media_type

source ·
macro_rules! media_type {
    ($ty:ident / $prefix:ident $(:: $subty:ident)* $(;$name:ident = $value:ident)*) => { ... };
    ($ty:ident / $prefix:ident $(:: $subty:ident)* + $suffix:ident $(;$name:ident = $value:ident)*) => { ... };
}
Expand description

Convenient macro to construct a MediaType.

assert_eq!(media_type!(TEXT/PLAIN).to_string(), "text/plain");
assert_eq!(media_type!(IMAGE/x_::ICON).to_string(), "image/x-icon");

assert_eq!(
    media_type!(IMAGE/SVG+XML; CHARSET=UTF_8).to_string(),
    "image/svg+xml; charset=UTF-8"
);
assert_eq!(
    media_type!(APPLICATION/vnd::OPENSTREETMAP_DATA+XML).to_string(),
    "application/vnd.openstreetmap.data+xml"
);