mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-09-28 17:53:28 +00:00
Add exercise async1
The goal here was to get the first bit of "muscle memory" for using the async and await keywords. The little story should make it more intuitive for users why asynchronous programming is needed in the first place. This exercise will be moved to the location corresponding to the book in a later commit, to keep the diff of this one clean.
This commit is contained in:
committed by
Mo Bitar
parent
e39e00e056
commit
fbb98ad4ea
@@ -1208,3 +1208,17 @@ name = "conversions5"
|
||||
dir = "23_conversions"
|
||||
hint = """
|
||||
Add `AsRef<str>` or `AsMut<u32>` as a trait bound to the functions."""
|
||||
|
||||
# ASYNC
|
||||
|
||||
[[exercises]]
|
||||
name = "async1"
|
||||
dir = "24_async"
|
||||
test = false
|
||||
hint = """
|
||||
Asynchronous runtimes like tokio can only spawn tasks that are defined as async
|
||||
functions, not regular ones. Add the "async" keyword before the "fn" keyword of
|
||||
the functions "tim", "carl" and "nick".
|
||||
|
||||
An async task can wait for another one to complete by "awaiting" it. Add
|
||||
".await" after the three "task_name" variables in the "block_on" call."""
|
||||
|
||||
Reference in New Issue
Block a user