# rust-study **Repository Path**: lansscar/rust-study ## Basic Information - **Project Name**: rust-study - **Description**: rust学习 - **Primary Language**: Rust - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-02-05 - **Last Updated**: 2021-09-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 笔记 ## 内容来源 - https://learning-rust.github.io ## crate 1. 一个程序有基本的两个入口: binary和library 2. binary默认入口为src/main.rs, library默认入口为lib.rs 3. 对binary和library各自来说,彼此同名,皆为程序名。如Cargo.toml::name="hello",则在main.rs中可以使用`hello::*`访问library中函数。 4. crate基本组织结构为: ``` . ├── lib.rs // 当前目录入口,必须在此暴露所有mod。如此例必须写mod str,则其他mod才可访问str ├── main.rs // 使用hello::str::format::*可以访问format.rs中所有内容 └── str ├── format.rs // 一个文件默认为一个mod,但是必须在mod.rs中注册 └── mod.rs // 当前目录入口,必须在此暴露所有mod。如此例必须写mod format ```