21
how I finally understood async/await in Rust (part 2)
(hegdenu.net)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
The hardest part (for me) is dealing with the type requirements for the handlers. 99% of the time a simple await is enough, but when it isn't, I feel like I need to go spelunking.
Especially dealing with those pinned structs for the state. I get why it's needed because it's on the stack somewhere but it sure makes it hard to work with without using pin_project or pin_project_lite.
Yeah I hope that will improve over time (maybe with the necessary ergonomic changes for async traits and higher kinded types). But I feel this is just a matter of time and will likely be much better after the next Rust edition