W3cubDocs

/Rust

Keyword async

Return a Future instead of blocking the current thread.

Use async in front of fn, closure, or a block to turn the marked code into a Future. As such the code will not be run immediately, but will only be evaluated when the returned future is .awaited.

We have written an async book detailing async/await and trade-offs compared to using threads.

Editions

async is a keyword from the 2018 edition onwards.

It is available for use in stable rust from version 1.39 onwards.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/keyword.async.html