diff options
| -rw-r--r-- | src/doc/trpl/crates-and-modules.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md index 63fdef0760f..bc2c827ca34 100644 --- a/src/doc/trpl/crates-and-modules.md +++ b/src/doc/trpl/crates-and-modules.md @@ -355,6 +355,10 @@ Hello in English: Hello! Goodbye in English: Goodbye. ``` +`pub` also applies to `struct`s and their member fields. In keeping with Rust’s +tendency toward safety, simply making a `struct` public won't automatically +make its members public: you must mark the fields individually with `pub`. + Now that our functions are public, we can use them. Great! However, typing out `phrases::english::greetings::hello()` is very long and repetitive. Rust has another keyword for importing names into the current scope, so that you can |
