Crate media_type [−] [src]
This crate provides a media type parser which is gerneric over the specific grammar.
Depending on where media types appear they grammar can diff from small aspects (like which characters are allowed win type, subtype and parameter names) to larger aspects (like allowing comments and soft line brakes :=\ ).
Intially this crate will provide impl. for Media Types in context of Http and such in context of Mime as well as a more strict parser for types which should be gennerally compatible with any grammar.
Note that while media types often seem simple, they have a lot of tricky aspects, for examples the semantics of parameter value comparsion depend on the actual parameter type, subtype combination, which given that anyone can use custom types/register new ones, means it's not possible to implement a general equality operation correctly. Because of the same reason in context of the fact that any non appearing parameter has a default value implementing a generally correct hashin function or even media-range matching function is not possible either.
This crate tries to have the best trate off between "korrectness", performance and depth of implementaion (special knowledge for some media types, e.g. that "charset=utf-8" and "charset=utf8" are equal). It tries to be easie to use for the most common use cases but at the same time to have the needed flexibility/funcionallity for more complex use cases.