rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Async exercises

Open mo8it opened this issue 1 year ago • 7 comments

The book will got a new chapter about async. We should add some async exercises.

mo8it avatar Jul 10 '24 14:07 mo8it

Any update on this? I would like to see some async exercises as well. :)

Polycarbohydrate avatar Mar 02 '25 21:03 Polycarbohydrate

Now that the async chapter is added to the book, I am open to exercise ideas :)

mo8it avatar Mar 02 '25 22:03 mo8it

Sound good 👍! I'll probably start thinking of ideas and start on async1.

I think we should probably put the async exercise folder after 20_threads (because of the ordering of the book and it just makes sense to do async exercises after learning concurrency) and async would be #21, 21_async. Would need to shift the rest of the exercises' respective numbers as well.

For the exercises, I was thinking at the very least, there would be 4 exercises to cover the lengthy chapter as well as most of the key points covered. In the book, the example code shown uses trpl for many async methods but I feel like using tokio would work better as it is well-known and used. Like the rest of the rustlings exercises, this section should start with some simple concepts of asynchronous programming in Rust and then work toward more advanced features (if wanted).

Polycarbohydrate avatar Mar 04 '25 02:03 Polycarbohydrate

Tokio for sure. Rustlings v6 allows adding dependencies to exercises, but this possibility is not used in any exercise yet.

mo8it avatar Mar 05 '25 15:03 mo8it

Rustlings v6 allows adding dependencies to exercises

Is there any documentation for this? I tried looking in the changelog and version history but I can't find anything.

Polycarbohydrate avatar Mar 07 '25 01:03 Polycarbohydrate

You just add the dependency to the dev/Cargo.toml file.

mo8it avatar Mar 07 '25 10:03 mo8it

Created a PR: https://github.com/rust-lang/rustlings/pull/2216

Fails the dev check (which I explained in the comment below the PR) and the MacOS check. Feedback is welcome :)

Polycarbohydrate avatar Mar 08 '25 01:03 Polycarbohydrate