-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mime crate #738
Comments
This enforces the typing system on it, the same goes for many parts of Hyper. It's actually a great feature, that ensures no cases are forgotten, and will make the compiler yell at you for any typo. |
@MichaelZapataScality I fail to see how that ensures no cases are forgotten. Can you clarify what you mean by that? |
On a |
I fail to see how match is helping though. First of all if something is Ext or not is pretty random at the moment. For instance you ned to use ext for all common vendor mimetypes. Secondly because of ext you can already not handle all. But ultimately you can make up completely bogus mimetypes with the current system anyways (for instance nobody stops you from making an image/json). A tuple mime type would still be a separate type. |
I agree, the mime crate needs some work. I've been working on a re-working of it, where a |
The work-in-progress rewrite: https://github.com/hyperium/mime.rs/tree/ng
|
👀 |
@mitsuhiko IANA regulates the MIME types, so they would be the ones stopping you. You could make something follow the same string format that MIME types use, but it would not be a MIME type. That's what the type system guarantees. |
@crawford the type system does not guarnatee that at all. As mentioned the type system allows me to construct |
So it's been a while, but I finally got around to having a redesign I think I like. See hyperium/mime#50 |
This is more of a suggestion than a bug, but it would appear that modelling mimetypes as anything other than raw strings is ridiculous overkill. Maybe some alternative method can be found where they are represented as a tuple
(mimetype, attributes)
instead?The text was updated successfully, but these errors were encountered: