File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
# The ` use ` declaration
2
2
3
3
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:
5
5
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
7
23
// Bind the `deeply::nested::function` path to `other_function`.
8
24
use deeply::nested::function as other_function;
9
25
@@ -37,4 +53,4 @@ fn main() {
37
53
38
54
function();
39
55
}
40
- ```
56
+ ```
You can’t perform that action at this time.
0 commit comments