# study-rust **Repository Path**: bearxup/study-rust ## Basic Information - **Project Name**: study-rust - **Description**: 学习rust的练习仓库 - **Primary Language**: Rust - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-07 - **Last Updated**: 2026-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hello-rust 跟着 [The Rust Programming Language](https://doc.rust-lang.org/book/title-page.html)(官方 Rust Book)学习 Rust 的练习仓库。代码会随着学习进度不断演变,属于练手性质,不是生产项目。 ## 当前进度 - **第 1 章 Getting Started**:`cargo new` 创建项目,并用 [ferris-says](https://crates.io/crates/ferris-says) 打印 Ferris 欢迎信息([src/main.rs](src/main.rs)) - **第 2 章 Programming a Guessing Game**:猜数字游戏([src/guessing_game.rs](src/guessing_game.rs)),涉及: - `let` / `mut` 变量与可变性 - `String`、引用(`&mut`) - 用 [rand](https://crates.io/crates/rand) 生成随机数 - `match` 与 `std::cmp::Ordering` 比较大小 - `loop` 循环、`Result` 与 `expect` 错误处理 - stdout 行缓冲与 `flush()` ## 环境 - Rust edition 2024 - crate 名为 `guessing_game`(见 [Cargo.toml](Cargo.toml)),目录名保留最初的 `hello-rust` ## 常用命令 ```bash cargo run # 编译并运行 cargo build # 仅编译 cargo check # 快速类型检查,不产出二进制 cargo test # 运行测试 cargo fmt # 格式化 cargo clippy # 静态检查 cargo add # 添加依赖 ``` ## 依赖 | crate | 用途 | | --- | --- | | [ferris-says](https://crates.io/crates/ferris-says) | 打印 Ferris(Rust 吉祥物)说话的 ASCII art | | [rand](https://crates.io/crates/rand) | 猜数字游戏的随机数生成 |