Skip to content

Commit e459fb3

Browse files
authored
Merge pull request #1097 from lf94/patch-1
Add how to use brace bracket syntax
2 parents 1f95397 + 6feca85 commit e459fb3

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/mod/use.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
# The `use` declaration
22

33
The `use` declaration can be used to bind a full path to a new name, for easier
4-
access.
4+
access. It is often used like this:
55

6-
```rust,editable
6+
```rust,editable,ignore
7+
// extern crate deeply; // normally, this would exist and not be commented out!
8+
9+
use deeply::nested::{
10+
my_first_function,
11+
my_second_function,
12+
AndATraitType
13+
};
14+
15+
fn main() {
16+
my_first_function();
17+
}
18+
```
19+
20+
You can use the `as` keyword to bind imports to a different name:
21+
22+
```rust,editable,ignore
723
// Bind the `deeply::nested::function` path to `other_function`.
824
use deeply::nested::function as other_function;
925
@@ -37,4 +53,4 @@ fn main() {
3753
3854
function();
3955
}
40-
```
56+
```

0 commit comments

Comments
 (0)