返回首页
⚔️已发布

rust-dojo

练 Rust,从你自己的代码开始

扫描你本地的 Rust 项目,从真实代码片段出题。不是刷通用题库,而是在你自己写过的代码上深挖。难度自适应,答对升级、答错降级,适合有一定基础想持续进阶的 Rustacean。

rust-dojo
╔══════════════════════════════════════════════╗
║       Rust Adaptive Quiz System              ║
║   q to quit  |  s to show progress          ║
╚══════════════════════════════════════════════╝

Scanned 312 local code snippets.

  #1 [Iterator & Collections] ★☆☆☆☆
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  // from scanner/mod.rs, lines 17-38
  fn collect_rs_files(dir: &Path, snippets: &mut Vec<CodeSnippet>) {
      let Ok(entries) = std::fs::read_dir(dir) else { return };
      for entry in entries.flatten() { ... }
  }

  Why does .flatten() appear here?
  What would happen without it?

功能亮点

  • 扫描本地项目,从真实代码片段生成题目
  • 两种模式:读懂代码(解释机制)+ 动手实现
  • 难度自适应 1–5★,答对升级、答错降级
  • 支持 OpenAI / Anthropic / 兼容接口,可配合 clawtoken 使用

快速开始

# 1. 克隆项目
git clone https://github.com/Hamiltonxx/rust-dojo

# 2. 创建配置文件
mkdir -p ~/.config/rust-dojo
cp config.example.toml ~/.config/rust-dojo/config.toml

# 3. 填入 API Key 和你的 Rust 项目路径
# api_key = "sk-ant-..."
# scan_dirs = ["~/projects/my-app"]

# 4. 运行
cargo run --release