Investigate adopting impl Trait
instead of our current Box<HandlerFuture>
#32
Labels
impl Trait
instead of our current Box<HandlerFuture>
#32
Originally discussed in the announcement thread, it would be nice if we could support concrete future types using the
impl Trait
feature which is currently only available on nightly Rust.What we actually need, though, is for
impl Trait
to be supported in the associated type position, and for the inferred type to be able to vary with the generic type parameters, which is being discussed at:We'll need a
Middleware
trait that looks something like:Here,
R
is the concrete type of the future returned by the nextMiddleware
. Though it's only used for thecall
function, it's likely to be important that this exists at the trait level instead, asSomeUsefulMiddleware::<R>::Output
will need to vary with theR
type.Implementing
Middleware
would then look something like:Constructing the middleware pipeline will be considerably more difficult with the
R
parameter here, so this will take some experimentation to prove that the idea works. If this is deemed a suitable way forward, we could investigate making a similar change toHandler
.The text was updated successfully, but these errors were encountered: