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.
This commit is contained in:
bors 2014-05-06 15:06:52 -07:00
commit df621acf5f
1 changed files with 10 additions and 8 deletions

View File

@ -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: