tower
tower copied to clipboard
service: improve unsized types' support
While Service impl for Box<S> covers unsized S case, the impl for &mut S is not, this PR is an attempt to fix that.
Also there are a few places in Service docs where the poll_ready call seems to be missing.
I'm curious what your use case for this is 🤔
I've personally considered removing this blanket impl and instead have a blanket impl for async functions so we wouldn't need service_fn.
Not that I particularly need this, I just spotted https://github.com/tower-rs/tower/issues/636 so I looked at tower-service API and noticed this minor asymmetry.
I really like the idea of adding blanket impl for async functions, however it seems that removing existing blanket impls would require reworking tower::util::Ready as its current impl relies on the &mut Service blanket impl. Maybe a bit unrelated example, but std::future::Future has a blanket impls for &mut Future and Box<Future> which to me seems quite useful, so maybe it would be worthy to keep similar blanket impls for tower::Service as well, just thinking...
Any thoughts on this?
I filed a proposal for removing the old blanket impls https://github.com/tower-rs/tower/pull/657