MCPcopy Index your code
hub / github.com/SandmeyerX/rustlings-zh-cn

github.com/SandmeyerX/rustlings-zh-cn @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
773 symbols 1,009 edges 188 files 73 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rustlings-zh-cn 🦀❤️

Tracking Status

[!NOTE] 新版 Rustlings 的 README 文件移除了以下内容,取而代之的是网站链接:Rustlings 🦀 这里为直观展示安装步骤,保留了原版内容的翻译

欢迎使用 Rustlings 练习题 简体中文版 😃 这个项目包含一些小练习,旨在帮助您习惯阅读和编写惯用的 Rust 代码。 这其中也包括阅读和参照编译器的信息!

建议在做 Rustlings 练习的同时阅读 Rust官方书籍(The Rust Book),这是学习 Rust 最全面的资源📚️

Rust By Example 是另一个推荐的资源,您可能会发现它很有帮助。 它包含与 Rustlings 类似的代码示例和练习,但需要在线上使用。

✨ 如果您在使用中遇到了任何问题,请在此处与我们联系!

入门指南

安装 Rust

在安装 Rustlings 之前,您需要安装 最新版本的 Rust。 访问 www.rust-lang.org/tools/install 以获取安装 Rust 的更多说明。 这也将安装 Rust 的包/项目管理器 Cargo

🐧 如果您使用 Linux,确保已安装 gcc(用于链接器)。

Deb:sudo apt install gcc。 Dnf:sudo dnf install gcc

🍎 如果您使用 MacOS,通过运行 xcode-select --install 确保已安装 Xcode 及其开发工具。

安装 Rustlings

以下命令将下载并编译 Rustlings:

cargo install rustlings

如果安装失败…点击展开

  • 通过运行 rustup update 确保您拥有最新的 Rust 版本
  • 尝试添加 --locked 标志:cargo install rustlings --locked
  • 否则,请 报告问题

下载练习题

安装 Rustlings 后,运行以下命令将 rustlings练习-简体中文版 下载到本地:

git clone https://github.com/SandmeyerX/rustlings-zh-cn.git

或者点击链接下载项目最新压缩包

开始练习

练习题下载完成后,在解压后的 rustlings-zh-cn 目录下运行以下命令:

rustlings

如果提示找不到命令rustlings(command cannot be found)…点击展开

您可能使用的是 Linux 并通过包管理器安装了 Rust。 Cargo 将二进制文件安装到 ~/.cargo/bin 目录。 遗憾的是,包管理器通常不会将 ~/.cargo/bin 添加到您的 PATH 环境变量中。

解决方案是…

  • 手动将 ~/.cargo/bin 添加到 PATH
  • 或者从包管理器中卸载 Rust,并使用官方的 rustup 方式安装:https://www.rust-lang.org/tools/install

Extension points exported contracts — how you extend this code

AppendBar (Interface)
特征 `AppendBar` 只有一个函数,该函数会将 "Bar" 追加到实现此特征的任何对象上。 [1 implementers]
solutions/15_traits/traits1.rs
AppendBar (Interface)
特征 `AppendBar` 只有一个函数,该函数会将 "Bar" 追加到实现此特征的任何对象上。 [1 implementers]
exercises/15_traits/traits1.rs
SomeTrait (Interface)
(no doc) [2 implementers]
solutions/15_traits/traits5.rs
SomeTrait (Interface)
(no doc) [2 implementers]
exercises/15_traits/traits5.rs
OtherTrait (Interface)
(no doc) [2 implementers]
solutions/15_traits/traits5.rs
OtherTrait (Interface)
(no doc) [2 implementers]
exercises/15_traits/traits5.rs
Licensed (Interface)
(no doc) [2 implementers]
solutions/15_traits/traits3.rs
Licensed (Interface)
(no doc) [2 implementers]
exercises/15_traits/traits3.rs

Core symbols most depended-on inside this repo

placeholder
called by 10
exercises/09_strings/strings4.rs
details
called by 8
solutions/19_smart_pointers/rc1.rs
details
called by 8
exercises/19_smart_pointers/rc1.rs
string
called by 7
solutions/09_strings/strings4.rs
parse
called by 5
solutions/13_error_handling/errors6.rs
get_map
called by 5
solutions/18_iterators/iterators5.rs
process
called by 5
solutions/08_enums/enums3.rs
get_map
called by 5
exercises/18_iterators/iterators5.rs

Shape

Function 612
Method 61
Class 58
Enum 30
Interface 12

Languages

Rust100%

Modules by API surface

solutions/23_conversions/try_from_into.rs18 symbols
exercises/23_conversions/try_from_into.rs18 symbols
solutions/18_iterators/iterators5.rs17 symbols
exercises/18_iterators/iterators5.rs16 symbols
solutions/23_conversions/from_into.rs15 symbols
exercises/23_conversions/from_into.rs15 symbols
solutions/23_conversions/from_str.rs14 symbols
exercises/23_conversions/from_str.rs14 symbols
solutions/13_error_handling/errors6.rs13 symbols
solutions/18_iterators/iterators3.rs12 symbols
exercises/18_iterators/iterators3.rs12 symbols
solutions/08_enums/enums3.rs11 symbols

For agents

$ claude mcp add rustlings-zh-cn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact