File tree 1 file changed +17
-1
lines changed
src/rust-2018/module-system
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -212,14 +212,30 @@ Much more straightforward.
212
212
In Rust 2015, if you have a submodule:
213
213
214
214
``` rust,ignore
215
+ /// foo.rs
216
+ /// or
217
+ /// foo/mod.rs
218
+
215
219
mod foo;
216
220
```
217
221
218
222
It can live in ` foo.rs ` or ` foo/mod.rs ` . If it has submodules of its own, it
219
223
* must* be ` foo/mod.rs ` . So a ` bar ` submodule of ` foo ` would live at
220
224
` foo/bar.rs ` .
221
225
222
- In Rust 2018, ` mod.rs ` is no longer needed. ` foo.rs ` can just be ` foo.rs ` ,
226
+ In Rust 2018, ` mod.rs ` is no longer needed.
227
+
228
+ ``` rust,ignore
229
+ /// foo.rs
230
+ /// foo/bar.rs
231
+
232
+ mod foo;
233
+
234
+ /// in foo.rs
235
+ mod bar;
236
+ ```
237
+
238
+ ` foo.rs ` can just be ` foo.rs ` ,
223
239
and the submodule is still ` foo/bar.rs ` . This eliminates the special
224
240
name, and if you have a bunch of files open in your editor, you can clearly
225
241
see their names, instead of having a bunch of tabs named ` mod.rs ` .
You can’t perform that action at this time.
0 commit comments