tide
tide copied to clipboard
src: move State off of Request (WIP)
error[E0119]: conflicting implementations of trait `endpoint::Endpoint<_>`:
--> src\endpoint.rs:70:1
|
54 | / impl<State, F, Fut, Res> Endpoint<State> for F
55 | | where
56 | | State: Send + Sync + 'static,
57 | | F: Send + Sync + 'static + Fn(Request) -> Fut,
... |
67 | | }
68 | | }
| |_- first implementation here
69 |
70 | / impl<State, F, Fut, Res> Endpoint<State> for F
71 | | where
72 | | State: Send + Sync + 'static,
73 | | F: Send + Sync + 'static + Fn(Request, State) -> Fut,
... |
83 | | }
84 | | }
| |_^ conflicting implementation
Not sure I understand this error. F should be a distinct type for both?? Note: the difference is in F and those compiler messages don't show enough lines for that.
I guess the compiler thinks F might implement both Fn(Request) -> Fut and Fn(Request, State) -> Fut. You can make such a type with #![feature(fn_traits, unboxed_closures)] by manually implementing Fn and its supertraits.
Err... this isn't solving the issue that #642 and #644 solve... this is just general ergonomics, imo? Likewise see https://github.com/http-rs/tide/issues/643#issuecomment-657621351
One interesting implication of this PR is that it would've made https://github.com/http-rs/tide/pull/670 easier to implement; no State means no Default either.