diff --git a/ch07-00-modules.html b/ch07-00-modules.html index e70c11120..6d0c808d4 100644 --- a/ch07-00-modules.html +++ b/ch07-00-modules.html @@ -68,16 +68,18 @@

Modules

-

When we write a program in Rust, your code starts off living in main. But as -your code grows, you eventually move functionality out into functions, both for -re-use, and for nicer organization. By splitting your code up into smaller -chunks, each chunk is easier to understand on its own. So what happens when we -start having too many functions? Rust has a module system that tackles both of -these problems. In the same way that we extract some lines of code into a -function, we can extract some functions (and other things too) into different -modules. A module is a namespace that contains definitions of functions or -types, and those definitions can be visible outside their module or not. Here's -an overview of how the bits fit together:

+

When you write a program in Rust, your code might start off living solely in +the main function. As your code grows, you eventually move functionality out +into functions, both for re-use and for nicer organization. By splitting your +code up into smaller chunks, each chunk is easier to understand on its own. So +what happens when you start having too many functions? Rust has a module system +that tackles both the problem of wanting to be able to re-use code and the +problem of keeping your code organized.

+

In the same way that you extract lines of code into a function, you can extract +functions (and other code like structs and enums too) into different modules. A +module is a namespace that contains definitions of functions or types, and +those definitions can be visible outside their module or not. Here's an +overview of how the bits fit together: