Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upInvestigate adopting `impl Trait` instead of our current `Box<HandlerFuture>` #32
Comments
smangelsdorf
added
the
discussion
label
Aug 20, 2017
smangelsdorf
referenced this issue
Aug 20, 2017
Merged
Named existentials and impl Trait variable declarations #2071
smangelsdorf
added
the
blocked
label
Sep 13, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
smangelsdorf commentedAug 20, 2017
Originally discussed in the announcement thread, it would be nice if we could support concrete future types using the
impl Traitfeature which is currently only available on nightly Rust.What we actually need, though, is for
impl Traitto 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
Middlewaretrait that looks something like:Here,
Ris the concrete type of the future returned by the nextMiddleware. Though it's only used for thecallfunction, it's likely to be important that this exists at the trait level instead, asSomeUsefulMiddleware::<R>::Outputwill need to vary with theRtype.Implementing
Middlewarewould then look something like:Constructing the middleware pipeline will be considerably more difficult with the
Rparameter 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.