Small exercises to get you used to reading and writing Rust code
github.com
github.com
If you have any particular Rust concepts that you'd like exercises for, please let me know here, file an issue, or even contribute an exercise! Errors that you've hit that took you out of your flow of working on something else are great candidates. I haven't been adding new exercises recently, but I would like to continue expanding.
Thanks! <3
So a Pittsburgher with a passion for rust? Color me surprised.
Guilty as charged :)
1: https://en.wikipedia.org/wiki/Western_Pennsylvania_English
See also http://www.pittsburghese.com/
Maybe the OP could contribute their exercises there, since their Rust exercises were not very good when I tried them.
One point that makes this particularly nice is the fact that for many languages of the compiled c++/Rust/etc kind there is a certain level of barrier for people coming from dynamic languages, and that is the non-existence of a repl where you can just try out basic idioms and constructs without having to manually set up a context. This kind of interactive environment kind of replaces that and therefore opens the language for much more people.
[0]: https://doc.rust-lang.org/std/sync/struct.Mutex.html#poisoni...
Other times where error-handling is important use a `match` there and then. And don't nest the arms of the match instead use the return of the match expression.
On the other hand, I found `try!` pretty awkward. Especially since quite often you need to create custom errors alongside it and can go down a rabbit hole in which you have to read confusing compiler messages from within macros about traits not being implemented correctly, and lifetimes missing, etc.
I learned Kotlin by glancing at the doc and then completing the kotlin koans.
I look forward to doing the same with Rust.
I.e. some examples of how to do OOP "the Rust way".