Skip to content

Commit 949143e

Browse files
committed
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.
1 parent bd3fb81 commit 949143e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/doc/tutorial.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -2992,21 +2992,23 @@ And here an example with multiple files:
29922992
~~~{.ignore}
29932993
// `a.rs` - crate root
29942994
use b::foo;
2995+
use b::c::bar;
29952996
mod b;
2996-
fn main() { foo(); }
2997+
fn main() {
2998+
foo();
2999+
bar();
3000+
}
29973001
~~~
29983002

29993003
~~~{.ignore}
3000-
// `b.rs`
3001-
use b::c::bar;
3004+
// `b/mod.rs`
30023005
pub mod c;
3003-
pub fn foo() { bar(); }
3006+
pub fn foo() { println!("Foo!"; }
30043007
~~~
30053008

3006-
~~~
3007-
// `c.rs`
3008-
pub fn bar() { println!("Baz!"); }
3009-
# fn main() {}
3009+
~~~{.ignore}
3010+
// `b/c.rs`
3011+
pub fn bar() { println!("Bar!"); }
30103012
~~~
30113013

30123014
There also exist two short forms for importing multiple names at once:

0 commit comments

Comments
 (0)