Ask HN: What are some good rust code to read to learn the language?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • Rustlings

    :crab: Small exercises to get you used to reading and writing Rust code!

    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/

  • idiomatic-rust

    🦀 A peer-reviewed collection of articles/talks/repos which teach concise, idiomatic Rust.

    Here is a peer-reviewed collection - https://github.com/mre/idiomatic-rust

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

  • extreme

    extremely boring async function runner! (by spacejam)

  • tiny-lsm

    super simple in-memory blocking LSM for constant-size keys and values

  • toydb

    Distributed SQL database in Rust, written as a learning project

  • tantivy

    Tantivy is a full-text search engine library inspired by Apache Lucene and written in Rust [Moved to: https://github.com/quickwit-oss/tantivy] (by quickwit-inc)

  • lust

    A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust. (by eatonphil)

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • mini-redis

    Incomplete Redis client and server implementation using Tokio - for learning purposes only

    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 Rust async 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

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts