From 949143e17ae5462967e46363f0d5855237143a44 Mon Sep 17 00:00:00 2001 From: Brandon Waskiewicz Date: Mon, 5 May 2014 22:41:10 -0400 Subject: [PATCH] Update multiple file use statement example 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. --- src/doc/tutorial.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index a847d47c7b9b1..0635f4111e550 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: