可视化/分析 Rust 容器的内部结构
一个用于可视化/分析箱体内部结构的货物插件。
随着时间的推移,随着您的 Rust 项目变得越来越大,适当地构建代码就变得越来越重要。
幸运的是, Rust 提供了一个非常先进的模块系统,使我们可以将我们的程序框架精确地分割成任意小的子模块,这些子模块包含类型和函数。
虽然这有助于避免单一的和非结构化的代码块,但有时也会使人难以在心中保持对当前项目的整体高级结构的了解。
这就是 cargo-modules 发挥作用的地方:
通过以下方式安装 cargo-modules:
cargo install cargo-modulescargo-modules 工具附带了一些命令:
# Print a crate's hierarchical structure as a tree:
cargo modules structure
# Print a crate's internal dependencies as a graph:
cargo modules dependencies
# Detect unlinked source files within a crate's directory:
cargo modules orphans 命令帮助
$ cargo modules --help
Visualize/analyze a crate's internal structure.
Usage: cargo-modules
Commands:
structure Prints a crate's hierarchical structure as a tree.
dependencies Prints a crate's internal dependencies as a graph.
orphans Detects unlinked source files within a crate's directory.
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help以树状结构打印货柜的层次结构:
cargo modules structure 命令帮助
…cd ./tests/projects/readme_tree_example
cargo-modules structure --cfg-test输出:
crate readme_tree_example
├── trait Lorem: pub
├── mod amet: pub(crate)
│ └── mod consectetur: pub(self)
│ └── mod adipiscing: pub(self)
│ └── union Elit: pub(in crate::amet)
├── mod dolor: pub(crate)
│ └── enum Sit: pub(crate)
└── mod tests: pub(crate) #[cfg(test)]
└── fn it_works: pub(self) #[test](项目源代码: [readme_tree_example/src/lib.rs](.
暂无开放 Issues,或尚未同步最近议题。