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
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • 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

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • 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

    Discontinued 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)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • 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