Add async-await exercises#2413
Closed
chrischiedo wants to merge 2 commits into
Closed
Conversation
Contributor
|
We didn't ask for AI generated exercises. @senekor is working on a set of exercises for the new version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR: This PR adds 4 new exercises on async-await to Rustlings.
Motivation: Rustlings was super helpful in my journey of understanding Rust early on. I first solved the exercises about four years ago (version@5.0.0). I recently went through the exercises again (mainly curious to see what had changed). What stood out for me was how easy it is to get started with the exercises now (
cargo install rustlings). But, I also realized that we didn't have exercises on async-await. The 3rd edition of The Rust Programming Book has a new chapter on Async Programming, and I thought it'd be great for us to have some exercises on Rustlings covering this new chapter.Challenge (and potential solution): Rust doesn't ship with an async runtime in the standard library. And so far, Rustlings doesn't have any external dependencies (it tries to stick to the standard library as much as possible). Fortunately, the authors of the Book have created the trpl crate that re-exports some of the important functionalities provided by Tokio, the popular async runtime for Rust.
Things to note:
trplcrate). This allows us to use theTokioruntime under the hood.async-awaitis a challenging topic (both in Rust, and in general). I've tried to add simple and (hopefully) clear exercises that assesses a learner's understanding of material in the Async chapter of the Book. Any form of feedback and/or suggestion(s) is highly welcome!