diff options
| author | bors <bors@rust-lang.org> | 2014-05-06 15:06:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-06 15:06:52 -0700 |
| commit | df621acf5f6f5e4e5d7170963ad7ed7dfe8e2d6c (patch) | |
| tree | 750861d39e8c7e567bd9db6c7f85bc04d408c6a8 | |
| parent | cf6857b9e9427f14d383ae2924555bedc251fa02 (diff) | |
| parent | 949143e17ae5462967e46363f0d5855237143a44 (diff) | |
auto merge of #13960 : brandonw/rust/master, r=alexcrichton
Update the example to make the usage of `pub mod foo;` much more apparent, as well as using an example where setting the visibility of the module is actually necessary.
| -rw-r--r-- | src/doc/tutorial.md | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index a847d47c7b9..0635f4111e5 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2992,21 +2992,23 @@ And here an example with multiple files: ~~~{.ignore} // `a.rs` - crate root use b::foo; +use b::c::bar; mod b; -fn main() { foo(); } +fn main() { + foo(); + bar(); +} ~~~ ~~~{.ignore} -// `b.rs` -use b::c::bar; +// `b/mod.rs` pub mod c; -pub fn foo() { bar(); } +pub fn foo() { println!("Foo!"; } ~~~ -~~~ -// `c.rs` -pub fn bar() { println!("Baz!"); } -# fn main() {} +~~~{.ignore} +// `b/c.rs` +pub fn bar() { println!("Bar!"); } ~~~ There also exist two short forms for importing multiple names at once: |
