# bembemm/rustlings architecture

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

- Interactive diagram: https://gitdiagram.com/bembemm/rustlings
- Repository: https://github.com/bembemm/rustlings

## Overview

Rustlings is a terminal-based Rust learning tool: learners choose an exercise, run it, inspect compiler/test/Clippy output, and advance as exercises pass. Its repository also provides initialization, exercise metadata and embedded assets, official solutions, and maintainer commands. The README documents the full curriculum through Async, quizzes, hints, and terminal UI. Several source excerpts are partial, so links between the main loop and unsampled runtime subsystems are omitted or marked unverified rather than inferred as definite calls.

Main entry points: [`src/main.rs`](https://github.com/bembemm/rustlings/blob/main/src/main.rs) (Command Entry), [`src/dev.rs`](https://github.com/bembemm/rustlings/blob/main/src/dev.rs) (Developer Commands), [`src/watch/state.rs`](https://github.com/bembemm/rustlings/blob/main/src/watch/state.rs) (Run Feedback), [`src/init.rs`](https://github.com/bembemm/rustlings/blob/main/src/init.rs) (Project Initialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Runtime"]
  node_main["Command Entry<br/>[main.rs]"]
  node_cli_args["CLI Arguments<br/>[cli.rs]"]
  node_app_state["Exercise State<br/>[app_state.rs]"]
  node_list_ui["Exercise Browser<br/>[state.rs]"]
  node_watch["Watch Loop<br/>[watch.rs]"]
  node_watch_state["Run Feedback<br/>[state.rs]"]
  node_run["Exercise Runner<br/>[run.rs]"]
  node_exercise["Compile and Run<br/>[exercise.rs]"]
  node_command["Cargo Commands<br/>[cmd.rs]"]
  node_editor["Editor Launch<br/>[editor.rs]"]
end

subgraph group_content["Learning Content"]
  node_metadata["Exercise Metadata<br/>[info_file.rs]"]
  node_embedded["Embedded Assets<br/>[embedded.rs]"]
  node_exercises["Exercise Curriculum"]
  node_solutions["Official Answers"]
end

subgraph group_maint["Project Tools"]
  node_init["Project Initialization<br/>[init.rs]"]
  node_cargo_bins["Cargo Bin Updates<br/>[cargo_toml.rs]"]
  node_dev["Developer Commands<br/>[dev.rs]"]
  node_dev_check["Exercise Checks<br/>[check.rs]"]
  node_dev_new["Community Project Setup<br/>[new.rs]"]
  node_dev_update["Project Update<br/>[update.rs]"]
end

subgraph group_support["Runtime Support"]
  node_terminal["Terminal Output<br/>[term.rs]"]
end

node_learner(("Learner"))

node_learner -->|"runs CLI"| node_main
node_main -->|"dispatches init"| node_init
node_main -->|"dispatches dev"| node_dev
node_main -->|"dispatches run"| node_run
node_main -.->|"parses options"| node_cli_args
node_main -.->|"loads metadata"| node_metadata
node_main -.->|"creates state"| node_app_state
node_main -.->|"starts browser"| node_list_ui
node_run -.->|"starts watch loop"| node_watch
node_watch -.->|"manages run state"| node_watch_state
node_watch_state -->|"runs current"| node_exercise
node_exercise -->|"invokes Cargo"| node_command
node_watch_state -.->|"renders feedback"| node_terminal
node_init -.->|"writes assets"| node_embedded
node_init -->|"updates manifest"| node_cargo_bins
node_embedded -->|"materializes exercises"| node_exercises
node_dev -->|"dispatches check"| node_dev_check
node_dev -->|"dispatches new"| node_dev_new
node_dev -->|"dispatches update"| node_dev_update

click node_main "https://github.com/bembemm/rustlings/blob/main/src/main.rs"
click node_cli_args "https://github.com/bembemm/rustlings/blob/main/src/cli.rs"
click node_app_state "https://github.com/bembemm/rustlings/blob/main/src/app_state.rs"
click node_list_ui "https://github.com/bembemm/rustlings/blob/main/src/list/state.rs"
click node_watch "https://github.com/bembemm/rustlings/blob/main/src/watch.rs"
click node_watch_state "https://github.com/bembemm/rustlings/blob/main/src/watch/state.rs"
click node_run "https://github.com/bembemm/rustlings/blob/main/src/run.rs"
click node_exercise "https://github.com/bembemm/rustlings/blob/main/src/exercise.rs"
click node_command "https://github.com/bembemm/rustlings/blob/main/src/cmd.rs"
click node_editor "https://github.com/bembemm/rustlings/blob/main/src/editor.rs"
click node_terminal "https://github.com/bembemm/rustlings/blob/main/src/term.rs"
click node_metadata "https://github.com/bembemm/rustlings/blob/main/src/info_file.rs"
click node_embedded "https://github.com/bembemm/rustlings/blob/main/src/embedded.rs"
click node_exercises "https://github.com/bembemm/rustlings/tree/main/exercises"
click node_solutions "https://github.com/bembemm/rustlings/tree/main/solutions"
click node_init "https://github.com/bembemm/rustlings/blob/main/src/init.rs"
click node_cargo_bins "https://github.com/bembemm/rustlings/blob/main/src/cargo_toml.rs"
click node_dev "https://github.com/bembemm/rustlings/blob/main/src/dev.rs"
click node_dev_check "https://github.com/bembemm/rustlings/blob/main/src/dev/check.rs"
click node_dev_new "https://github.com/bembemm/rustlings/blob/main/src/dev/new.rs"
click node_dev_update "https://github.com/bembemm/rustlings/blob/main/src/dev/update.rs"

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_main,node_cli_args,node_app_state,node_list_ui,node_watch,node_watch_state,node_run,node_exercise,node_command,node_editor toneBlue
class node_metadata,node_embedded,node_exercises,node_solutions toneAmber
class node_init,node_cargo_bins,node_dev,node_dev_check,node_dev_new,node_dev_update toneMint
class node_terminal toneRose
class node_learner toneIndigo
```

## Components

### CLI Runtime

- [Command Entry](https://github.com/bembemm/rustlings/blob/main/src/main.rs): `src/main.rs`
- [CLI Arguments](https://github.com/bembemm/rustlings/blob/main/src/cli.rs): `src/cli.rs`
- [Exercise State](https://github.com/bembemm/rustlings/blob/main/src/app_state.rs): `src/app_state.rs`
- [Exercise Browser](https://github.com/bembemm/rustlings/blob/main/src/list/state.rs): `src/list/state.rs`
- [Watch Loop](https://github.com/bembemm/rustlings/blob/main/src/watch.rs): `src/watch.rs`
- [Run Feedback](https://github.com/bembemm/rustlings/blob/main/src/watch/state.rs): `src/watch/state.rs`
- [Exercise Runner](https://github.com/bembemm/rustlings/blob/main/src/run.rs): `src/run.rs`
- [Compile and Run](https://github.com/bembemm/rustlings/blob/main/src/exercise.rs): `src/exercise.rs`
- [Cargo Commands](https://github.com/bembemm/rustlings/blob/main/src/cmd.rs): `src/cmd.rs`
- [Editor Launch](https://github.com/bembemm/rustlings/blob/main/src/editor.rs): `src/editor.rs`

### Learning Content

- [Exercise Metadata](https://github.com/bembemm/rustlings/blob/main/src/info_file.rs): `src/info_file.rs`
- [Embedded Assets](https://github.com/bembemm/rustlings/blob/main/src/embedded.rs): `src/embedded.rs`
- [Exercise Curriculum](https://github.com/bembemm/rustlings/tree/main/exercises): `exercises`
- [Official Answers](https://github.com/bembemm/rustlings/tree/main/solutions): `solutions`

### Project Tools

- [Project Initialization](https://github.com/bembemm/rustlings/blob/main/src/init.rs): `src/init.rs`
- [Cargo Bin Updates](https://github.com/bembemm/rustlings/blob/main/src/cargo_toml.rs): `src/cargo_toml.rs`
- [Developer Commands](https://github.com/bembemm/rustlings/blob/main/src/dev.rs): `src/dev.rs`
- [Exercise Checks](https://github.com/bembemm/rustlings/blob/main/src/dev/check.rs): `src/dev/check.rs`
- [Community Project Setup](https://github.com/bembemm/rustlings/blob/main/src/dev/new.rs): `src/dev/new.rs`
- [Project Update](https://github.com/bembemm/rustlings/blob/main/src/dev/update.rs): `src/dev/update.rs`

### Runtime Support

- [Terminal Output](https://github.com/bembemm/rustlings/blob/main/src/term.rs): `src/term.rs`

### Other components

- **Learner**

## Connections

- Learner → Command Entry: runs CLI (evidence: `README.md`)
- Command Entry → Project Initialization: dispatches init (evidence: `src/main.rs`)
- Command Entry → Developer Commands: dispatches dev (evidence: `src/main.rs`)
- Command Entry → Exercise Runner: dispatches run (evidence: `src/main.rs`)
- Command Entry → CLI Arguments: parses options (evidence: `src/main.rs`)
- Command Entry → Exercise Metadata: loads metadata (evidence: `src/main.rs`)
- Command Entry → Exercise State: creates state (evidence: `src/main.rs`)
- Command Entry → Exercise Browser: starts browser
- Exercise Runner → Watch Loop: starts watch loop
- Watch Loop → Run Feedback: manages run state (evidence: `src/watch.rs`)
- Run Feedback → Compile and Run: runs current (evidence: `src/watch/state.rs`)
- Compile and Run → Cargo Commands: invokes Cargo (evidence: `src/exercise.rs`)
- Run Feedback → Terminal Output: renders feedback
- Project Initialization → Embedded Assets: writes assets (evidence: `src/init.rs`)
- Project Initialization → Cargo Bin Updates: updates manifest (evidence: `src/init.rs`)
- Embedded Assets → Exercise Curriculum: materializes exercises (evidence: `src/embedded.rs`)
- Developer Commands → Exercise Checks: dispatches check (evidence: `src/dev.rs`)
- Developer Commands → Community Project Setup: dispatches new (evidence: `src/dev.rs`)
- Developer Commands → Project Update: dispatches update (evidence: `src/dev.rs`)
