Why isn't hyper's Service ensuring the poll_ready invariant with typing?
Docs (https://docs.rs/hyper/0.14.18/hyper/service/trait.Service.html#required-methods) say that the user is supposed to wait until poll_ready returns Ready(Ok()) with calling call. Why not instead have poll_ready return Poll<SomeType, Error> and have `call` be a function on SomeType (that takes it by value and consumes it)?
@krzyz Ah, a thing I was missing was that `call` wants mutable access to Service. Thus, if we wanted to make `call` a method on the token, we'd need to have the token borrow the service mutably. However, that we cannot do: the token appears as a result of the future sometime in an uncertain future. So, we need to have call take both a &mut Service and the token, which sort-of requires the ability to have the type system enforce that we use the token with the service it came from.
I see why this doesn't work straightforwardly, but I don't see why GATs solve this issue and what does the issue have to do with behaviour on dropping.