Rust 1.39.0 stable update adds async-await

The latest version of Rust is now available and introduces a big change for the language. 1.39.0 adds async-await. This feature moves out of beta and is now stable. The use of asynchronous code allows users to run multiple tasks concurrently on the same OS thread. See what other changes are now available to Rust, Cargo, and Clippy.
Rust 1.39.0 stable is here, bringing changes to the language as well some updates for Cargo and Clippy.
It’s been a good year for Rust. The latest State of the Octoverse 2019 report reveals that Rust is the second fasting growing programming language, with a change of 235%. The language’s community is quickly expanding.
Will the language continue to grow with the new changes made in the latest release?

Fastest growing languages. Source: State of the Octoverse 2019
Async I/O
The biggest change in version 1.39.0 is the introduction of async-await. This feature was first proposed back in 2016 and now three years later, it is available in stable Rust.
What is async-await? You may already know how it works in languages such as C#, Dart, Kotlin, or JavaScript.
From the Asynchronous Programming in Rust guide:
Asynchronous code allows us to run multiple tasks concurrently on the same OS thread…Overall, asynchronous applications have the potential to be much faster and use fewer resources than a corresponding threaded implementation. However, there is a cost. Threads are natively supported by the operating system, and using them doesn’t require any special programming model– any function can create a thread, and calling a function that uses threads is usually just as easy as calling any normal function. However, asynchronous functions require special support from the language or libraries.
In order to use async-await, useasync fn
syntax instead of just fn
. async fn
returns a Future
. , which is waiting to run on an executor.
To execute Future
, you use .await
.
This new feature marks a big shift in the language. Future updates will include more improvements, extensions, and ecosystem expansions for async-await. Since the beta release, Rust has already changed and improved previously unhelpful diagnostics.
Check out the async-await guide and learn how to build an echo server.