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;
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短