Rust by Example logo

Rust by Example

Free

Learn Rust via runnable examples

FreeFree tier
Type
Open Source
Company
Rust Project

About Rust by Example

Rust by Example (RBE) is a comprehensive collection of runnable examples that illustrate various Rust programming language concepts and standard libraries. It covers topics from Hello World and primitive types to advanced features like generics, traits, macros, error handling, and unsafe operations. The resource is designed for learners who want to see Rust syntax and idioms in action, with examples that can be run locally after installing Rust. It also integrates with official Rust documentation and provides keyboard shortcuts for easy navigation.

Key Features

Collection of runnable examples covering Rust concepts and standard libraries
Topics range from Hello World to advanced features like macros and unsafe operations
Keyboard shortcuts for navigation and search within the book
Integrates with official Rust documentation and encourages local Rust installation
Covers primitives, custom types, variable bindings, type conversion, expressions, flow control, functions, modules, crates, cargo, attributes, generics, scoping, traits, error handling, std library types, testing, compatibility, and meta topics
Open source with source code available on GitHub

Pros & Cons

Pros
  • Free and open source resource
  • Comprehensive coverage of Rust topics with runnable examples
  • Well-organized with clear progression from basics to advanced topics
  • Integrates with official Rust documentation for deeper learning
  • Supports keyboard shortcuts for efficient browsing
Cons
  • Examples require local Rust installation to run interactively
  • No interactive code editor or execution online; relies on copying and running locally
  • Not a step-by-step tutorial; example-based learning may not suit all learners
  • Lacks video or multimedia explanations

Best For

Learning Rust programming from scratch through practical examplesTeaching Rust concepts in classrooms or workshopsReference material for Rust syntax, idioms, and standard library usageSelf-paced study for developers transitioning to Rust

FAQ

What is Rust by Example?
Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries, designed to help learners understand Rust through practical code snippets.
Is Rust by Example free?
Yes, Rust by Example is completely free and open source. Its source code is available on GitHub.
Do I need to install Rust to use Rust by Example?
While you can browse the examples online, to actually run them you should install Rust locally as recommended on the site.
What topics does Rust by Example cover?
It covers a wide range of topics including Hello World, primitives, custom types, variable bindings, type conversion, expressions, flow control, functions, modules, crates, Cargo, attributes, generics, scoping rules, traits, macros, error handling, standard library types, testing, unsafe operations, compatibility, and meta topics like documentation and benchmarking.