Expand description
Simple Media-Type library that focuses on ease of use Media Types are
used to specify the media type and subtype of data in the body of a message and to fully specify the native representation (canonical form) of such data – Based on RFC-7231 and RFC-2046 and originally developed from RFC-1049 Media types specify the contents of a message or body, but can be more specific than your code requires Any media type that is less specific should match.
use fuzzy_mime::BorrowedMediaType;
let media_type = BorrowedMediaType::parse("application/json;charset=utf-8").unwrap();
assert!(media_type.matches("application/json"))
Mime types which are more specific will fail
ⓘ
use fuzzy_mime::BorrowedMediaType;
let media_type = BorrowedMediaType::parse("application/json").unwrap();
assert!(media_type.matches("application/json;charset=utf-8"))
Structured types that extend another also work
use fuzzy_mime::BorrowedMediaType;
let media_type = BorrowedMediaType::parse("application/vnd.docker.distribution.manifest.v1+json").unwrap();
assert!(media_type.matches("application/json"))
Structs§
- Borrowed
Media Type - A borrowed Media-Type The main type everything is implemented for
Enums§
- Parse
Error - Possible errors when parsing a Media-Type