Skip to content

Commit a7b0c1a

Browse files
committed
feat: update module docs
1 parent 16f5f97 commit a7b0c1a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/docs/module6/2_rust_modules.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mod core; // Tells Rust to look for core.rs or core/mod.rs
2828
The second approach is more common for larger applications and is what you'll use in this module.
2929

3030
:::info
31-
When you declare a `mod core` the compiler is going to look for a file called `core.rs` **OR** `core/mod.rs`
31+
When you declare a `mod core` the compiler is going to look for a file called `core.rs` **OR** `core/mod.rs`. If you have a relatively simple module, using a single file is great. As the code in your module starts to grow though, it might be more beneficial to move that to a folder then split the single file down into independent files
3232
:::
3333

3434
### Module Visibility
@@ -40,6 +40,7 @@ Everything is private to the current file as a default in Rust
4040
:::
4141

4242
- No modifier: Private to the current module
43+
- `no identifier`: Private within the current file
4344
- `pub`: Public, visible everywhere
4445
- `pub(crate)`: Visible only within the current crate
4546
- `pub(super)`: Visible to the parent module

docs/docs/module6/4_challenge.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sidebar_position: 4
77
Now it's time to apply what you've learned about modular architecture! In this module's challenge, you'll:
88

99
1. Take the monolithic web API from the previous module and split it into a modular architecture
10-
2. Create separate files for:
11-
- `core.rs`: Containing your domain models and business logic
12-
- `data_access.rs`: Containing your data storage mechanism
10+
2. Create separate modules for:
11+
- `core`: Containing your domain models and business logic, this should use the folder (`core`) method for defining a module
12+
- `data_access.rs`: Containing your data storage mechanism, this should use the single file method for defining a module
1313
- `main.rs`: For your API endpoints and application setup
1414
3. Apply appropriate visibility modifiers to enforce architectural boundaries
1515
4. Ensure all modules are properly connected and the API still works as expected

0 commit comments

Comments
 (0)