pencil
pencil copied to clipboard
Re-export hyper Request
The field Request.request
is a hyper::server::request::Request
. Please consider re-exporting (pub use) that type (e.g. as HyperRequest
) in your API, so that users don't have to add an explicit dependency on a specific version of Hyper.
If we are doing that, we might need to re-export everything else too, not a good idea. For now I think it is ok for one application to depend on a specific version of Hyper if the app needs it. If there are any better solutions, please wake me up :)
Iron is also re-exporting Hyper types.
The problem is that the user needs to update the version of Hyper every time he/she updates pencil (even for a minor version). And to be able to do that, one needs to look at the source repository at that version to see the exact dependency requirement.
I would propose to do the entire opposite: hide hyper as much as possible and only give access to it through well hidden APIs. Hyper will undergo big changes going forward from what I can tell and the typed high level access is actually really inconvenient as a user.
I would propose to find the places where one currently needs to get the hyper object and instead to provide convenience APIs to avoid it. For instance there should be a header view for the request to access the header values a strings. Likewise there should be a way to set and view response headers as strings without having to interface with hyper as well.
Ideally in the public API hyper is entirely invisible.
WRT version mismatches: cargo is planning on coming up with a story for such public API re-exports so this will get easier going forward.
Hide hyper as much as possible, we should try to do this better.
I think I agree with @mitsuhiko.