Consider moving `State` off of `Request`
- Dominant language
- Rust
- Stars
- 5.1k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice to not have `Request` have a generic parameter, for e.g. the `AsyncRead` trait which requires pinning. See https://github.com/http-rs/tide/pull/642#issuecomment-657141853 for where this was originally encountered.
However in interest of keeping middleware simple it would still be nice to allow `(Request, Next) -> Fut>`, but for `State` it would probably ideal to have an extra parameter, kinda like Surf's `Client`, e.g. `(Request, State, Next) -> Fut>`.
I was thinking maybe `server.middleware()` / endpoints could take `impl Into>` / endpoint, and so then that trait could be applied to both of the above with an extra function wrapper for the simple case, allowing both to work, and scoping `State` to the middleware/endpoint stack.
Contributor guide
Assessment
This issue has not been assessed yet.