在我的电脑上哪里可以找到“std::collections”模块?

Where can I find the `std::collections` module on my computer?

我目前正在学习 Rust 中的模块和 crate,我认为我可以通过查看一个真实且非常常用的模块来最好地学习:std::collections。我希望能够查看此包的实际文件。但是,我在我的电脑上找不到它。我查看了我创建项目的文件夹(以及所有子文件夹)以及 C:/users/(username)/.cargo 文件夹。我是 运行 x64 Windows 10 PC。请让我知道在我的系统上哪里可以找到 std::collections 模块。谢谢!

通过 rustup 检索的组件的默认位置在按工具链组织的 $HOME/.rustup/ 中。源代码是 rust-src 组件的一部分,可能需要通过 rustup component add rust-src 手动安装。然后可以在 lib/rustlib/src/rust/library/std.

中找到 std 箱子

因此 Windows 上 std::collections 模块的完整路径应该是:

C:\Users\<USER>\.rustup\toolchains\<TOOLCHAIN>\lib\rustlib\src\rust\library\std\src\collections

另请参阅: