Skip to main content

parse_media_type

Function parse_media_type 

Source
pub fn parse_media_type(value: &[u8]) -> Result<MediaType<'_>, ParseError>
Expand description

Parses a Content-Type style media type with the default Limits.

§Errors

As parse.

§Examples

let mt = parse_net::parse_media_type(b"text/html; charset=UTF-8")?;
assert!(mt.essence_is("text/html"));
assert!(mt.charset().is_some_and(|c| c.eq_ignore_ascii_case(b"utf-8")));