http-rs / http-types

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

Remove directives #247

Closed yoshuawuyts closed 4 years ago

yoshuawuyts commented 4 years ago

Removes all intermediate Directive* types in favor of a wildcard and set_wildcard method on the containing type. This closes #241, but also addresses the same design flaw in the conditional series of PRs we just merged. Thanks!

yoshuawuyts commented 4 years ago

Oh also worth noting: this patch only changes unreleased APIs so it isn't a breaking change.

yoshuawuyts commented 4 years ago

I kinda thought the old api was neat, but I don't feel strongly about it.

The old API made it tricky to implement comparison methods; e.g. "does this etag match" was quite awkward and required keeping a temporary var to see if globs are accepted. Instead by tracking globs at compile-time this logic is simpler, and we can remove the intermediate structs.