Hacker News new | ask | show | jobs
by jkarneges 2541 days ago
For anyone wanting to understand how to implement a basic engine for std::future from scratch, I mashed some code until it worked: https://gist.github.com/jkarneges/cb1ee686ef97bb05ebe04b5fc6...

It's based mostly on this article, which predates std::future: https://www.viget.com/articles/understanding-futures-in-rust...

2 comments

Thank you. We really need more examples... and hopefully a full guide to futures/async. As someone currently in the outskirts of the Rust community, it's really hard to 'peer inside' what's happening and how to use it in practical applications. It's a matter of time, but it's just so exciting xD
There is an “async book” in the works, by the working group. You’re 100% right that good docs will be important here!
Here's another example how to mix futures 0.1 and async/await together.

https://github.com/pimeys/blocking_test/