1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-24 09:46:45 +02:00

Day2: Afternoon - speaker note details and minor cosmetic changes. (#408)

* A few speaker notes in Day2: Afternoon and minor cosmetic changes.

* Do not test filesystem example code block.
This commit is contained in:
Marko Zagar
2023-02-16 03:19:25 +00:00
committed by GitHub
parent 93d61b2e7d
commit fe21b773e7
4 changed files with 49 additions and 4 deletions

View File

@ -20,3 +20,34 @@ The `crate` root is in:
* `src/lib.rs` (for a library crate)
* `src/main.rs` (for a binary crate)
<details>
* The change from `module/mod.rs` to `module.rs` doesn't preclude the use of submodules in Rust 2018.
(It was mandatory in Rust 2015.)
The following is valid:
```ignore
src/
├── main.rs
├── top_module.rs
└── top_module/
└── sub_module.rs
```
* The main reason for the change is to prevent many files named `mod.rs`, which can be hard
to distinguish in IDEs.
* Rust will look for modules in `modulename/mod.rs` and `modulename.rs`, but this can be changed
with a compiler directive:
```rust,ignore
#[path = "some/path.rs"]
mod some_module { }
```
This is useful, for example, if you would like to place tests for a module in a file named
`some_module_test.rs`, similar to the convention in Go.
</details>