Doc fix: list all module files Rust looks for.
1. In the English/Japanese phrases example in the "Multiple File Crates" section of the "Crates and Modules" chapter, there are a total of 8 module files that Rust looks for, while only four were listed. This commit lists all 8 explicitly. 2. Title case fix.
This commit is contained in:
parent
d841c15704
commit
a7d15ce6a6
@ -118,7 +118,7 @@ build deps examples libphrases-a7448e02a0468eaa.rlib native
|
|||||||
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
|
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
|
||||||
crate from another crate, let’s break it up into multiple files.
|
crate from another crate, let’s break it up into multiple files.
|
||||||
|
|
||||||
# Multiple file crates
|
# Multiple File Crates
|
||||||
|
|
||||||
If each crate were just one file, these files would get very large. It’s often
|
If each crate were just one file, these files would get very large. It’s often
|
||||||
easier to split up crates into multiple files, and Rust supports this in two
|
easier to split up crates into multiple files, and Rust supports this in two
|
||||||
@ -190,13 +190,19 @@ mod farewells;
|
|||||||
```
|
```
|
||||||
|
|
||||||
Again, these declarations tell Rust to look for either
|
Again, these declarations tell Rust to look for either
|
||||||
`src/english/greetings.rs` and `src/japanese/greetings.rs` or
|
`src/english/greetings.rs`, `src/english/farewells.rs`,
|
||||||
`src/english/farewells/mod.rs` and `src/japanese/farewells/mod.rs`. Because
|
`src/japanese/greetings.rs` and `src/japanese/farewells.rs` or
|
||||||
these sub-modules don’t have their own sub-modules, we’ve chosen to make them
|
`src/english/greetings/mod.rs`, `src/english/farewells/mod.rs`,
|
||||||
`src/english/greetings.rs` and `src/japanese/farewells.rs`. Whew!
|
`src/japanese/greetings/mod.rs` and
|
||||||
|
`src/japanese/farewells/mod.rs`. Because these sub-modules don’t have
|
||||||
|
their own sub-modules, we’ve chosen to make them
|
||||||
|
`src/english/greetings.rs`, `src/english/farewells.rs`,
|
||||||
|
`src/japanese/greetings.rs` and `src/japanese/farewells.rs`. Whew!
|
||||||
|
|
||||||
The contents of `src/english/greetings.rs` and `src/japanese/farewells.rs` are
|
The contents of `src/english/greetings.rs`,
|
||||||
both empty at the moment. Let’s add some functions.
|
`src/english/farewells.rs`, `src/japanese/greetings.rs` and
|
||||||
|
`src/japanese/farewells.rs` are all empty at the moment. Let’s add
|
||||||
|
some functions.
|
||||||
|
|
||||||
Put this in `src/english/greetings.rs`:
|
Put this in `src/english/greetings.rs`:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user