Rust Language Resources

Feel free to add anything!

General learning resources

Rust course from Richard Feldman

He’s known from his work in the Elm community.

“The Book”

A book about Rust also apparently referred to as “The Book” in the Rust community.

Youtube Series going through “The Book”

A youtube series going through the above book.

“The Rust Programming Language”

by Steve Klabnik and Carol Nichols

Rustlings

Rustlings is an interactive set of exercises to get hands on practice while learning Rust. Each exercise has a compiler error or a failing unit test. Your task is to go through and fix things. It gives you hints if you get stuck.

Learn Rust in Y minutes

A very dense & quick overview of lots of Rust syntax & more.

Traits

dyn Trait and impl Trait can be new/confusing syntax and is fairly subtle:

Smart Pointer Types

https://doc.rust-lang.org/1.5.0/book/choosing-your-guarantees.html

Async

Understanding Async (Rust Futures) better by building an executor for them:
https://rust-lang.github.io/async-book/02_execution/04_executor.html

A post about from Tokio’s author about its executor:

Async recursion isn’t possible out-of-the-box. There exists a macro to help with that:
async_recursion package

By default async fns in traits are disallowed:
“why async fn in traits are hard”

Recursion

If you’re used to functional programming languages and used to creating recursive data structure & recursive functions for working with them, you might be surprised to hear that in Rust recursion is not discouraged.

Here’s a discussion about representing an AST and its functions in Rust in the help forum that may be helpful for people coming from e.g.Haskell:

Linked Lists

Linked lists in Rust are discouraged, just like recursion.
There’s fringe cases for when they’re useful, but it’s somewhat hard to do in rust.
This book goes over how that could work and teaches you a lot about different kinds of smart pointers in the process:

Sizedness in Rust

Rust types can have their “size” (in bytes) known at compile time, or they may be unsized.
Read this if you come across “x doesn’t have size known at compile time” errors or “?Sized” bounds and don’t know what these mean:

Finding good rust stuff

For crates, there’s Crate List - Blessed.rs - A list of popular crates organized by use case.

@pinkforest also started a meta awesome list, sort of a “Rust Awesome Awesome list”: GitHub - RustAU/Awesome-Awesome: The Awesome list of Awesome's

See also her reply to this topic for more great info on various recommended traits & learning material: Rust Language Resources - #13 by pinkforest

6 Likes

I’m partway through this course, which has been a great intro for someone new to the language:

3 Likes

I think this one is great because it breaks down the Rust Language Book which I find to be very useful.

1 Like

This looks like a fun rust book: Introduction - Learning Rust With Entirely Too Many Linked Lists

I’ll add it to the list above

1 Like

Almost forgot to share this amazing resource.

Once you start working with Rust, this cheat sheet is a nice refresher to have when you get stuck.
I find myself revisiting it for Rust ABI details. It also contains some PL theoretic information that will help you understand Rust better.

I added the “Smart Pointer Types” section with this link:
https://doc.rust-lang.org/1.5.0/book/choosing-your-guarantees.html

1 Like

Rust added this:
https://learnxinyminutes.com/docs/rust/

Take a look - it’s not much & it really helps as a quick syntax primer I think.

1 Like

To recommend another book, post first learnings: https://rust-for-rustaceans.com/ by Jon Gjengset. His YouTube content is also fantastic, and much of it is live streamed: https://www.youtube.com/c/jongjengset. He really dives into concepts.

To add to posts I enjoy, async/await really has some exciting underpinnings around safe futures, e.g. https://blog.cloudflare.com/pin-and-unpin-in-rust/. However, the complexity brings about some difficulties: Pin and suffering. The later post also links to a blog that I most enjoy in fighting with Rust: Articles.

3 Likes

Rustlings is an interactive set of exercises to get hands on practice while learning Rust:

It’s pretty great! Each exercise has a compiler error or a failing unit test. Your task is to go through and fix things. It gives you hints if you get stuck.

2 Likes

I edited the first section to remove the embeds. They were all differently sized, and I think this layout is more approachable.

1 Like

Added a section about “Sizedness in Rust” and a good blog post about that.

2 Likes

In conjunction to that. Cheat.rs helps with understanding what these layouts look like in memory.

1 Like

Some stuff that may or not make dealing with concurrency easier more Rusty :crab: way

Rusty way for this is often paired to knowing the go-to crate for anything as std / core stabilisations are hard given the guarantees Rust has taken on it’s approach with backwards compatibility meaning often these said advancements that hit eventually into std/core library are available via crates. A good example to understand this is the std::sync::mpsc related PR in rust-lang.

These are some of my go-to concurrency crates from A to Z:

  • async-stream
  • crossbeam - Tools for concurrent programming
  • dashmap - Concurrent HashMap with ergonomic API
  • glommio - Thread per core + io_uring + Direct IO
  • left-right - Reads over a single-writer data structure
  • loom - Permutation testing for concurrent code
  • lunatic - Who needs async? Bias: I’m a contibutor
  • once_cell - Slowly making it’s way into std.
  • parking_lot - More compact/efficient impls
  • rayon - Data parallelism
  • state - Effortless thread local state management

lock-free concurrency FtW :smiling_face_with_three_hearts:

Also using Stream has great resources out there

Beyond this I recommend looking into what Rust-lang #async-wg is up to:

Other resources around refactoring async

I/O (Often esoteric) Speed-Ups

Also incase there isn’t enough Awesome Rust :crab: lists
… I made a list of Awesome Rust - Awesome-Awesome Rust

3 Likes

Wow! Thank you so much @pinkforest for this… I really want to incorporate this into the wiki post in the beginning but it’s so much, I don’t even know what the best format would be :sweat_smile:

At the very least I’ll add a link to your reply and awesome-awesome-list!

This reminds me of Crate List - Blessed.rs. It’s a list of all the more popular crates for various use cases. It should probably be in the wiki post, I’ll add that too :slight_smile:

1 Like

I added blessed.rs into the Awesome-Awesome thanks - gotta have em all! :slight_smile:

2 Likes

One more thing ?

Some less known data oriented things…

  • rust serialization benchmarks
  • tantivy - Search engine library - think Lucene but Rust MIT
  • bonsaiDB - A programmable, ACID-compliant, document-database inspired by CouchDB.
  • Timely dataflow a low-latency cyclic dataflow computational model - Naiad: a timely dataflow system
  • qdrant - Vector database & search engine
  • nebari - database implementation using an append-only B-Tree
  • rayon - A data parallelism library for Rust
  • rkyv - Zero-copy deserialization framework for Rust (sadly no wasm yet)
  • petgraph - a graph data structure library
  • gdsl - another graph data-structure library
  • quick-xml - XML
  • okaywal - A Write Ahead Log (WAL) implementation
  • surrealdb - document-graph database
  • atomic-data-rust - Atomic graph data thing
  • arrow-datafusion - Apache Arrow DataFusion SQL Query Engien
  • gluesql - GlueSQL is quite sticky. It attaches to anywhere.
  • graph_safe_compare - Equivalence predicate that can handle cyclic, shared, and very-deep graphs.
  • embedded-msgpack - no_std friendly MessagePack impl
  • minicbor - no_std friendly CBOR - BlueOak-1.0.0
  • ciborium - another CBOR - Apache 2.0 only
  • tikv - key-value db
  • rust-rocksdb - Yes Rocks but Rust Rocks (just bindings though I remember)
  • redb - lmdb inspired embedded friendly ACID compliant k/v DB
  • Bonus No-Data-But-Anyways: fail - Fail points for rust.
  • Honorable mention: sled - Eternal champagne of Beta (this is stuck)

Tame all the SQL

  • sqlx - The Rust SQL Toolkit (PostgreSQL, MySQL + SQLite)
  • sea-query - Dynamic query builder works well with sqlx
  • sea-orm - ORM … if you need / want it - sqlx friendly
  • diesel - ORM + Query builder (non-async I remember?)

Protobuf’s

  • prost - The go-to .proto impl for Tonic
  • tonic - go-to tokio gRPC over HTTP/2
  • quick-protobuf - minimal allocations a.k.a “quick”
  • pb-rs - .proto to quick-profobuf compatible .rs
  • protobuf-parse - .proto parser library

Bonus: moar Web stuff ?

BonusBonus: rustle - Svelte compiler rewritten in Rust :hopes_up:
BonusBonusBonus: deno :dinosaur:
BonusBonusBonusBons: swc :woman_shrugging:

Bonus: Fuse (Partly cheating here with C/++)

  • dokany - I cheated it’s C dokany Windows fuse wrap
  • fuse-rs - Rust library for filesystems in userspace (FUSE)
  • fuser - Filesystem in Userspace (FUSE) for Rust
  • libfuse - The reference implementation of the Linux FUSE
  • s3fs-fuse - C++heat: FUSE-based file system backed by Amazon S3
  • winfuse - Again I cheat with C - FUSE for the Windows kernel
  • winsfp - C Cheat: Windows File System Proxy - FUSE for Windows
3 Likes