From 8368df8ef35b4e0876e9e6b9b5667962f9c994d6 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 30 Aug 2016 18:04:15 +0000 Subject: [PATCH] rebuild pages at 33943ea --- ch07-00-modules.html | 22 ++-- ch07-01-mod-and-the-filesystem.html | 40 +++---- ch07-02-controlling-visibility-with-pub.html | 26 ++--- ch07-03-importing-names-with-use.html | 17 +-- print.html | 105 ++++++++++--------- 5 files changed, 108 insertions(+), 102 deletions(-) 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: