Introduction to async/await (for javascript developers)?

Hi community!
I'm looking to read more about how async await will be used in the future. I am having a difficult time finding technical posts of how async works in rust as most google result discuss syntax, or something related to the current state of async.

Coming from javascript, from what I've read I get the feeling async works quite differently in rust. I would like to read more about why, and what the exact differences are.

My question is: does anyone have good links to learn more about this subject?

One of the Async working groups is working on a async book - it's still quite incomplete, but there's some good info there.

Also, the Tokio docs are a very good introduction to futures. Similar to how JavaScript async/await is built on top of promises, Rust async/await is built on top of futures, so it's a good idea to learn a bit about them.

2 Likes

Alright, didn't know about the book!

So learning about Futures will still be relevant when async/await is ready? Will tokio still be needed?

I don't think understanding futures will be an absolute requirement for using async/await, but yeah, it'll definitely be helpful to have an idea of what your code is compiling down to :slight_smile:

And yes, Rust does not have a built-in runtime for futures, so Tokio (and other similar libraries) will still be used once async/await is released. The idea is that you will write async code, whether it be with the syntax sugar or with raw futures, and then pass it to an executor to actually run it to completion.

The async working group has a project called runtime which will simplify this by setting up a runtime for you behind the scenes, allowing you to write an async main function.

2 Likes

I see. I'll invest my time in learning about tokio. Thanks a bunch!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.