Rust 模块树
示例
档案:
-example.rs(root of our modules tree, generally namedlib.rsormain.rswhen using Cargo) - first.rs - second/ - mod.rs - sub.rs
模块:
- example -> example
- first -> example::first
- second -> example::second
- sub -> example::second::sub
- third -> example::thirdexample.rs
pub mod first;
pub mod second;
pub mod third {
...
}例如second,必须在example.rs文件中声明该模块,因为它的父级example不是(而不是),first因此不能first.rs 在同一目录级别的或另一个文件中声明该模块。
second/mod.rs
pub mod sub;
热门推荐
1 破五祝福语简短的
10 祝女儿六一祝福语简短
11 毕业祝福语老婆生日简短
12 父亲婚礼祝福语经典简短
13 升学了祝福语简短句
14 交接同事退休祝福语简短
15 祝福语闺蜜简短单纯
16 放假假期祝福语简短精辟
17 文案生日祝福语高级简短
18 官宣祝福语简短霸气