This repository contains commented solutions for the Ruslings exercises, adding brief notes on what was necessary to complete the challenges (except where too obvious).
Whenever relevant, I also added different ways that the code could be written (in many cases in a more idiomatic way).
I use the Better Comments VSCode extension.
While regular comments are either original to the files or used to include different solutions in the same code block, comments in the format below were used to display notes or explanations (notice the "*"):
// * This is an explanation
I used this excellent repository as a learning reference, and to compare my solutions to already existing ones:
https://github.com/wh5a/rustlings-solutions/
The rusting exercises, particulary the hints, offer many direct references to the documentation.
Exercise to Book Chapter mapping
Exercise | Book Chapter |
---|---|
variables | §3.1 |
functions | §3.3 |
if | §3.5 |
primitive_types | §3.2, §4.3 |
vecs | §8.1 |
move_semantics | §4.1-2 |
structs | §5.1, §5.3 |
enums | §6, §18.3 |
strings | §8.2 |
modules | §7 |
hashmaps | §8.3 |
options | §10.1 |
error_handling | §9 |
generics | §10 |
traits | §10.2 |
tests | §11.1 |
lifetimes | §10.3 |
iterators | §13.2-4 |
threads | §16.1-3 |
smart_pointers | §15, §16.3 |
macros | §19.6 |
clippy | §21.4 |
conversions | n/a |