http-rs / http-types

Common types for HTTP operations
https://docs.rs/http-types
Apache License 2.0
200 stars 84 forks source link

Refactor media type internals #310

Closed yoshuawuyts closed 3 years ago

yoshuawuyts commented 3 years ago

This dedupes some internal logic of our media types, and refactors them to use Cow. This also moves utf-8 detection from a nested enum to a flag. Overall this simplifies the internals of our media types without any external API changes.

I was trying to address https://github.com/http-rs/tide/issues/27#issuecomment-750921221, but this is still blocked on the stdlib. However it seems that the only change we need to make now is to add StructuralEq to Vec and Cow so that they work in const contexts. Which should be slightly more feasible.

yoshuawuyts commented 3 years ago

This has been in review for a good while now. This is just a refactor and doesn't add any new API surface, so going to go ahead and merge this.