# rust-lang/rust-by-example architecture

> Architecture diagram of the GitHub repository rust-lang/rust-by-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rust-lang/rust-by-example
- Repository: https://github.com/rust-lang/rust-by-example

## Overview

Rust By Example is an instructional book for learning Rust through runnable examples, with a live code editor. The reader’s workflow is to access the book online or locally, study its topic chapters, and use the editor alongside examples. The graph preserves major documented subject areas; because no source excerpts were provided, it does not infer calls or links between chapters. The README documents the editor’s inclusion but does not identify its implementation or an external service.

Main entry points: [`src/index.md`](https://github.com/rust-lang/rust-by-example/blob/master/src/index.md) (Rust By Example), [`src/meta/playground.md`](https://github.com/rust-lang/rust-by-example/blob/master/src/meta/playground.md) (Live code editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_book["Book access"]
  node_guide["Rust By Example<br/>[index.md]"]
  node_editor["Live code editor<br/>[playground.md]"]
end

subgraph group_basics["Language foundations"]
  node_hello["Output and formatting<br/>[hello.md]"]
  node_bindings["Variables and scope"]
  node_flow["Control flow<br/>[flow_control.md]"]
  node_functions["Functions and closures<br/>[fn.md]"]
end

subgraph group_abstractions["Types and abstractions"]
  node_types["Types and primitives<br/>[types.md]"]
  node_custom["Custom types<br/>[custom_types.md]"]
  node_generics["Generics<br/>[generics.md]"]
  node_traits["Traits<br/>[trait.md]"]
end

subgraph group_errors["Errors and flow"]
  node_errors["Error handling<br/>[error.md]"]
  node_conversion["Conversions<br/>[conversion.md]"]
end

subgraph group_ecosystem["Rust ecosystem"]
  node_standard["Standard library<br/>[std.md]"]
  node_std_misc["Standard library utilities<br/>[std_misc.md]"]
  node_crates["Crates and modules<br/>[crates.md]"]
  node_cargo["Cargo<br/>[cargo.md]"]
  node_testing["Testing<br/>[testing.md]"]
  node_unsafe["Unsafe Rust<br/>[unsafe.md]"]
end

node_reader(("Reader"))

node_reader -->|"reads"| node_guide
node_guide -->|"includes editor"| node_editor

click node_guide "https://github.com/rust-lang/rust-by-example/blob/master/src/index.md"
click node_editor "https://github.com/rust-lang/rust-by-example/blob/master/src/meta/playground.md"
click node_hello "https://github.com/rust-lang/rust-by-example/blob/master/src/hello.md"
click node_bindings "https://github.com/rust-lang/rust-by-example/blob/master/src/variable_bindings.md"
click node_flow "https://github.com/rust-lang/rust-by-example/blob/master/src/flow_control.md"
click node_functions "https://github.com/rust-lang/rust-by-example/blob/master/src/fn.md"
click node_types "https://github.com/rust-lang/rust-by-example/blob/master/src/types.md"
click node_custom "https://github.com/rust-lang/rust-by-example/blob/master/src/custom_types.md"
click node_generics "https://github.com/rust-lang/rust-by-example/blob/master/src/generics.md"
click node_traits "https://github.com/rust-lang/rust-by-example/blob/master/src/trait.md"
click node_errors "https://github.com/rust-lang/rust-by-example/blob/master/src/error.md"
click node_conversion "https://github.com/rust-lang/rust-by-example/blob/master/src/conversion.md"
click node_standard "https://github.com/rust-lang/rust-by-example/blob/master/src/std.md"
click node_std_misc "https://github.com/rust-lang/rust-by-example/blob/master/src/std_misc.md"
click node_crates "https://github.com/rust-lang/rust-by-example/blob/master/src/crates.md"
click node_cargo "https://github.com/rust-lang/rust-by-example/blob/master/src/cargo.md"
click node_testing "https://github.com/rust-lang/rust-by-example/blob/master/src/testing.md"
click node_unsafe "https://github.com/rust-lang/rust-by-example/blob/master/src/unsafe.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_guide,node_editor toneBlue
class node_hello,node_bindings,node_flow,node_functions toneAmber
class node_types,node_custom,node_generics,node_traits toneMint
class node_errors,node_conversion toneRose
class node_standard,node_std_misc,node_crates,node_cargo,node_testing,node_unsafe,node_reader toneIndigo
```

## Components

### Book access

- [Rust By Example](https://github.com/rust-lang/rust-by-example/blob/master/src/index.md): `src/index.md`
- [Live code editor](https://github.com/rust-lang/rust-by-example/blob/master/src/meta/playground.md): `src/meta/playground.md`

### Language foundations

- [Output and formatting](https://github.com/rust-lang/rust-by-example/blob/master/src/hello.md): `src/hello.md`
- [Variables and scope](https://github.com/rust-lang/rust-by-example/blob/master/src/variable_bindings.md): `src/variable_bindings.md`
- [Control flow](https://github.com/rust-lang/rust-by-example/blob/master/src/flow_control.md): `src/flow_control.md`
- [Functions and closures](https://github.com/rust-lang/rust-by-example/blob/master/src/fn.md): `src/fn.md`

### Types and abstractions

- [Types and primitives](https://github.com/rust-lang/rust-by-example/blob/master/src/types.md): `src/types.md`
- [Custom types](https://github.com/rust-lang/rust-by-example/blob/master/src/custom_types.md): `src/custom_types.md`
- [Generics](https://github.com/rust-lang/rust-by-example/blob/master/src/generics.md): `src/generics.md`
- [Traits](https://github.com/rust-lang/rust-by-example/blob/master/src/trait.md): `src/trait.md`

### Errors and flow

- [Error handling](https://github.com/rust-lang/rust-by-example/blob/master/src/error.md): `src/error.md`
- [Conversions](https://github.com/rust-lang/rust-by-example/blob/master/src/conversion.md): `src/conversion.md`

### Rust ecosystem

- [Standard library](https://github.com/rust-lang/rust-by-example/blob/master/src/std.md): `src/std.md`
- [Standard library utilities](https://github.com/rust-lang/rust-by-example/blob/master/src/std_misc.md): `src/std_misc.md`
- [Crates and modules](https://github.com/rust-lang/rust-by-example/blob/master/src/crates.md): `src/crates.md`
- [Cargo](https://github.com/rust-lang/rust-by-example/blob/master/src/cargo.md): `src/cargo.md`
- [Testing](https://github.com/rust-lang/rust-by-example/blob/master/src/testing.md): `src/testing.md`
- [Unsafe Rust](https://github.com/rust-lang/rust-by-example/blob/master/src/unsafe.md): `src/unsafe.md`

### Other components

- **Reader**

## Connections

- Reader → Rust By Example: reads (evidence: `README.md`)
- Rust By Example → Live code editor: includes editor (evidence: `README.md`)
