Live data from Hacker News

Ask HN: What are some good Rust code samples?

news.ycombinator.com

1–10 of 25 posts

Re: Ask HN: What are some good Rust code samples?

#5
I’d recommend working through rustlings rather than watching videos for basic rust understanding: https://github.com/rust-lang/rustlings. It is essentially a set of quick exercises to get you familiar with the language and how to fix common build errors.

For advanced Rust “Jon Gjengset” has posted a number of long-form videos on YouTube that are very good. Search for it.

For code examples, find a crate in an area that you are interested in and clone the repo. There are so many to choose from that it would be unfair to single anything out. Variation is good, not bad. If you see lots of generics and macros then skip it for early learning purposes.

Instead of writing something from scratch I’d recommend rewriting something you are familiar with in but in Rust. For example, if you did advent of code (if that is your thing) in python then write it in Rust and find a repo of someone who solved the same problems in Rust.

The Rust book is excellent. https://doc.rust-lang.org/stable/book/

Re: Ask HN: What are some good Rust code samples?

#8
I know it's not what you are looking for, but I am going to share that I have my eyes on the book "Hands-on Rust: Effective Learning through 2D Game Development and Play" [0]. I will start working through it by the mid-end of 2022.

I am always bored out by most programming language books because most of them are listing for the language's API. This is accessible through the docs. Instead, I like books, where I get to learn something new by actually doing something. That's why this book.

I also like books that teach you what the language can do, how it makes your quality of life better, or maybe ups my level by a lot. Two such books that come to mind are: 1)SICP 2)Programming in Haskell by Hutton.

I hope to learn not only Rust with it, but also 2D game programming- or at least a little of it.

I started with the Rust book earlier and made some headway, but quickly lost interest because I was far away from doing something with it, and also my work is far removed from Rust.

[0]: https://pragprog.com/titles/hwrust/hands-on-rust/

Re: Ask HN: What are some good Rust code samples?

#9
post #3

A friend of mine who is very much into learning rust is following https://twitter.com/RustRepos on twitter and says its a great way to see what's upcoming and learn from it.

Along the lines of "What's upcoming and learn from it", I've found the https://this-week-in-rust.org/ weekly newsletter valuable for this.

Re: Ask HN: What are some good Rust code samples?

#10

I’d recommend working through rustlings rather than watching videos for basic rust understanding: https://github.com/rust-lang/rustlings . It is essentially a set of quick exercises to get you familiar with the language and how to fix common build errors. For advanced Rust “Jon Gjengset” has posted a number of long-form videos on YouTube that are very good. Search for it. For code examples, find a crate in an area th…

> For advanced Rust “Jon Gjengset” has posted a number of long-form videos on YouTube that are very good. Search for it.

Jon has also released a book called "Rust for Rustaceans", aimed at intermediate ("experienced") developers, to provide them with both idiomatic and ergonomic rust solutions, as well as deeper understanding of the more advanced concerns of the language (macros, async, unsafe, ...).

Post reply on HN