How to Use Manual Run Mode in Rustlings Watch Mode

To use manual run mode in Rustlings watch mode, start the tool with the --manual-run flag and press r to execute the current exercise on demand instead of relying on automatic file detection.

The Rustlings project is the official interactive exercise collection for learning Rust, maintained by the Rust Language organization. When working through exercises in watch mode, the tool typically monitors your source files for changes and automatically re-runs the current exercise. However, in containerized environments or on certain filesystems, this automatic detection fails, making manual run mode in Rustlings watch mode essential for a smooth learning experience.

What Is Manual Run Mode in Rustlings?

Manual run mode is a fallback mechanism designed for environments where file system watchers cannot operate reliably. By default, rustlings watch uses notify::RecommendedWatcher to detect when you save changes to an exercise file. When this watcher fails—common in Docker containers, WSL, or network-mounted filesystems—you can disable it entirely and trigger execution manually.

The implementation spans several core modules in the rust-lang/rustlings repository:

Starting Rustlings with the Manual Run Flag

To activate manual run mode, append the --manual-run flag when launching the watch command:

rustlings watch --manual-run

When you execute this command, the following internal process occurs:

  1. src/main.rs (lines 34-38) parses Args::manual_run and sets notify_exercise_names to None, signaling that no file watcher should be created.
  2. src/watch.rs (lines 68-92) receives this signal in the run_watch function, setting manual_run = true and skipping the initialization of notify::RecommendedWatcher.
  3. The UI initializes without automatic file monitoring, displaying the prompt with the r:run option visible.

How to Trigger Exercises Manually

Once in manual run mode, the workflow changes from automatic to on-demand execution:

  1. Edit your exercise file (e.g., exercises/01_variables/variables1.rs) in your editor.
  2. Save the file—no automatic execution occurs.
  3. Return to the Rustlings terminal window and press r.

The key press is processed through the following chain:

  • src/watch/terminal_event.rs (lines 38-40) captures the r key in terminal_event_handler and maps it to InputEvent::Run.
  • The event propagates to the main watch loop in src/watch.rs, which calls WatchState::run_current_exercise.
  • src/watch/state.rs (lines 92-95) ensures the r:run hint appears in the prompt only when manual_run is active.

When to Use Manual Run Mode

You should use the --manual-run flag in the following scenarios:

  • Containerized Development: When running Rustlings inside Docker or Podman, the notify crate often cannot access the host's filesystem events.
  • Windows Subsystem for Linux (WSL): WSL1 and some WSL2 configurations have limited inotify support, causing the automatic watcher to fail silently or with the NOTIFY_ERR message.
  • Network Filesystems: NFS, SMB, or other remote mounts may not propagate file change events to the local watcher.
  • Resource Constraints: On systems with strict file descriptor limits, disabling the watcher reduces resource consumption.

If the automatic detection fails, Rustlings displays the NOTIFY_ERR constant (defined in src/watch.rs, lines 84-90), which explicitly recommends running rustlings --manual-run to deactivate the file watcher.

Summary

  • Manual run mode disables the automatic file watcher in Rustlings, allowing you to trigger exercise execution on demand.
  • Launch with rustlings watch --manual-run to skip notify::RecommendedWatcher initialization and avoid filesystem detection issues.
  • Press r in the watch UI to manually execute the current exercise, handled by terminal_event_handler in src/watch/terminal_event.rs.
  • Use this mode in Docker containers, WSL environments, or when the automatic watcher fails with the NOTIFY_ERR message.

Frequently Asked Questions

What is the difference between rustlings watch and rustlings watch --manual-run?

Standard rustlings watch uses a file system watcher to automatically detect when you save changes to an exercise file and immediately re-runs the exercise. When you add --manual-run, the tool skips creating the notify::RecommendedWatcher entirely, requiring you to press r to trigger execution manually. The UI prompt shows r:run only when manual mode is active.

Why does the file watcher fail in Docker or WSL?

The file watcher relies on OS-specific notification systems like inotify on Linux. Docker containers often run with restricted capabilities or on overlay filesystems that don't propagate these events to the host. WSL1 lacks full inotify support, and while WSL2 improved this, cross-filesystem access (Windows files accessed from WSL) still breaks file watching. In these cases, Rustlings displays the NOTIFY_ERR message defined in src/watch.rs.

Can I switch from manual mode to automatic mode without restarting?

No, you cannot toggle between modes while the watch process is running. The manual_run boolean is set during initialization in src/watch.rs based on the CLI flag, and the watcher thread is either created or omitted at startup. To change modes, you must quit the current session with q and restart Rustlings with or without the --manual-run flag.

What other keyboard shortcuts are available in Rustlings watch mode?

Besides r for manual run (when enabled), the watch mode supports several shortcuts handled in src/watch/terminal_event.rs: h displays a hint for the current exercise, l lists all exercises, c checks all exercises across the entire course, x resets the current exercise to its original state, and q quits the program. The available options are displayed in the bottom prompt managed by src/watch/state.rs.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →