Rocket v0.5 Release Candidate
rocket.rs
rocket.rs
impl Foo for Bar {
// GAT ↓ TiiT ↓
type Output<'a> = impl Future<Output = Foo> + 'a;
fn foo<'a>(&'a self) -> Self::Output<'a> { ... }
}
The above is possible on nightly, whereas on stable you would have to box the future, and because you can't capture from self, you would have to use a ref counted pointer or clone the parts of self you need. Eventually, this entire transformation would allow for async fns directly in traits, but that is probably a long way off [2].[0]: https://github.com/rust-lang/rust/issues/63063
[1]: https://github.com/rust-lang/rust/issues/44265
[2]: http://smallcultfollowing.com/babysteps/blog/2019/10/26/asyn...