From fbde06b4193a1a1cda9223da2aab95ff6ed3894b 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index a847d47c7b9b1..b189b23949a4a 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2992,20 +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!"); } +// `b/c.rs` +pub fn bar() { println!("Bar!"); } # fn main() {} ~~~