3 ms·
For anyone looking for a TLDR, dynamic dispatch is the major missing piece. The only other reason is if you need to support a compiler version < 1.75
by vlovich123 3y ago
For anyone looking for a TLDR, dynamic dispatch is the major missing piece. The only other reason is if you need to support a compiler version < 1.75
- pitaj 3y agoI've seen dynamic dispatch mentioned twice. What do you mean? Isn't that just `fn foo() -> Box<dyn Future<...>>`?
- gdcbe 3y agoDynamic dispatch is where you call a method on a Box<dyn T> type, where T is a trait. Cfr: https://doc.rust-lang.org/1.8.0/book/trait-objects.html https://doc.rust-lang.org/1.8.0/book/trait-objects.html This in contrast to generics which is static.
- gdcbe 3y agoYeah and I was trying to implement their workaround for missing dynamic dispatch in a generic-heavy multithreaded async (tokio, hyper) context.., Cfr: https://github.com/plabayo/tower-async/pull/12 https://github.com/plabayo/tower-async/pull/12 So far didn’t manage to produce a box that works without everything else in my tower async stack having to need send sync trait bounds as well… and of course needing nightly ‘call(): Send’ return bounds. Despite that, haven’t found a reasonable working solution to support that in ‘tower-async’ Might be just me still having to b learn a lot. More then happy to hear feedbacks add help on these matters. And of course this is a WIP. So fully understand. Respect to the entire async wg team. Onwards and forward.