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:
Remo Senekowitsch
2026-08-29 22:39:33 +03:00
committed by Mo Bitar
parent e39e00e056
commit fbb98ad4ea
5 changed files with 140 additions and 0 deletions
+14
View File
@@ -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."""