Live data from Hacker News

Ask HN: What are some good Rust code samples?

news.ycombinator.com

21–25 of 25 posts

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

#21

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…

Absolutely no... The book is not user friendly for new learners. It's good, but not for beginners. BTW It's 600 pages!

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

#23
post #21

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…

Absolutely no... The book is not user friendly for new learners. It's good, but not for beginners. BTW It's 600 pages!

Strongly disagree. User friendly doesn't mean "short", it means "accessible for newcomers" in this context. And the rust book very much is that: it starts out extremely basic/simple and builds from there. Anecdotally and for many others it's been the best way to develop a solid understanding of the language.

Rust is somewhat "shortcut resistant" for new learners: you can pick it up by just starting coding after reading a few blog-post-length tutorials and backfilling understanding, the way many people do with other languages, but this typically takes much longer and incurs more frustration with Rust than, say, Python. That's because Rust takes longer to understand than most languages (I say this as someone who enjoys the language and expects it to become quite widely used, not as a criticism). Hence the book: it's long, but quite friendly. It's just not what you'd expect if you compare it to other learn-a-language-in-x-hours experiences.

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

#24
For learning async Rust, mini-redis repo is hard to surpass: https://github.com/tokio-rs/mini-redis

The code is simple enough for beginners to follow, but also complex enough to demonstrate async Rust in the wild. And best of all, the code is heavily commented!

You can follow the official Tokio tutorial to implement mini-redis incrementally: https://tokio.rs/tokio/tutorial/setup

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

#25
post #21

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…

Absolutely no... The book is not user friendly for new learners. It's good, but not for beginners. BTW It's 600 pages!

I disagree - I found the book to be very valuable when learning Rust. I agree it would not be good if Rust is your first programming language. But I think many beginners to Rust are people who are already experienced programmers and basically just want to know some mental models for how Rust's memory model works, some useful idioms and patters, "how to do X in Rust", and how to get started.
Post reply on HN