← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 10645 · 生成模型:未记录

模块树组织定义

理解等级:初级

mod 为一组相关定义创建命名空间,模块可以容纳其他模块、函数、结构体、枚举和 trait。每个 crate 的模块树从隐含的 crate 模块起步。位于同一父模块的子模块是兄弟模块,比如 front_of_house 下的 hosting 和 serving。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《The Rust Programming Language(第2版)》第07章 用包、crate 和模块管理增长中的项目(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c07.xhtml`,块 0063) - 结论依据:餐厅的模块树具体解释了根、父子、兄弟的关系。 - 原始内容:This tree shows how some of the modules nest inside other modules; for example, hosting nests inside front_of_house. The tree also shows that some modules are siblings, meaning they’re defined in the same module; hosting and serving are siblings defined within front_of_house.