Rust模块系统管理

Rust referred to as the module system, include:

    Packages: A Cargo feature that lets you build, test, and share crates
    Crates: A tree of modules that produces a library or executable
    Modules and use: Let you control the organization, scope, and privacy of paths
    Paths: A way of naming an item, such as a struct, function, or module

A package contains a [Cargo.toml] file that describes how to build those crates.
规则:
     A package must contain zero or one library crates, and no more. 
     src/main.rs is the crate root of a binary crate with the same name as the package.
     src/lib.rs library crate root;
     
 The use keyword that brings a path into scope;
 The pub keyword to make items public. 
 The as keyword, external packages, and the glob operator.
 

定义Module:
    mod关键字 + 名字
    mod mod_name {
            
    }
    Mod

你可能感兴趣的:(rust)