What you will find here

This book is a compendium of Rust ecosystem examples, recipes, and links. It is intended to be everything you need for day-to-day Rust coding, in one place.

It quickly summarizes the basics of the language and often-used elements of the standard library.

It then focuses on cross-cutting concerns that affect most aspects of development e.g. error handling, error customization, configuration, logging...

Concurrency, including asynchronous programming, are covered in details.

Next are tools, such as Cargo, Clippy, Rustfmt, as well as links and examples specific to programming domains such as CLI and Web development. The links section provides pointers to notable Rust websites, books, and code examples.

Who should read this book?

This book is intended both for new Rust programmers (to get an overview of the capabilities of the Rust ecosystem and pointers to other resources) and for experienced programmers (to find code examples and review best practices for common programming tasks).

Readers should have already some basic familiarity with Rust⮳ concepts. The Rust book⮳ is an excellent resource for complete beginners to get started with.

Why this book?

Per the curated list of Rust crates blessed.rs⮳, "the standard library in Rust is much smaller than in Python or Go, for example. Those languages come with "batteries included" support ... Rust, on the other hand, gets things like that from the crates.io ecosystem and the Cargo package manager. But with almost more than 100 thousand crates to choose from, a common complaint from new Rust developers is that they don't know where to start, which crates they ought to use, and which crates they ought to trust." There are (not yet) dominant frameworks or platforms like Rails, Django, Spring or Node in the Rust world.

This book intends to provide EXAMPLES to demonstrate the use of key Rust crates, examples which are absent from or scattered in the typically dry reference docs⮳, and hopes to become a "cheat sheet on steroid" for the Rust ecosystem (not just the Rust language).

What other books should I consult?

Rust by Example⮳ is similar in concept - a collection of runnable examples - but not in scope, as it focuses solely on the Rust language and standard libraries.

The Rust cookbook⮳ demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. It focuses mainly on std and a few core crates.

Call for contributions

This book is in its early days - feel free to submit an issue or a pull request to the repo.

Contributions, from small edits to whole chapters, are most welcome. Draft pages are kept in this folder. An informal (and very long) list of topics of interest is kept in TODO. Embedded examples should be ideally runnable on the Rust playground⮳ or at least directly copy-pasteable into Rust code. Please read CONTRIBUTING.md for more details.

Its long-term goal is the coverage of the 'most commonly used' Rust crates, as defined by blessed.rs⮳, the most downloaded libraries in crates.io⮳, and 'high quality crates' per lib.rsstatistics⮳. Review key crates for topic ideas.

This site is not affiliated with the Rust Foundation⮳.