Commit b36ce30 1 parent db4f1f2 commit b36ce30 Copy full SHA for b36ce30
File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
> ** <sup >Syntax:<sup >** \
4
4
> _ ExternCrate_ :\
5
- >   ;  ; ` extern ` ` crate ` [ IDENTIFIER] & nbsp ; (` as ` ( [ IDENTIFIER] | ` _ ` ) )<sup >?</sup > ` ; `
5
+ >   ;  ; ` extern ` ` crate ` ( [ IDENTIFIER] | ` self ` ) (` as ` ( [ IDENTIFIER] | ` _ ` ) )<sup >?</sup > ` ; `
6
6
7
7
An _ ` extern crate ` declaration_ specifies a dependency on an external crate.
8
8
The external crate is then bound into the declaring scope as the [ identifier]
9
- provided in the ` extern crate ` declaration.
9
+ provided in the ` extern crate ` declaration. The ` as ` clause can be used to
10
+ bind the imported crate to a different name.
10
11
11
12
The external crate is resolved to a specific ` soname ` at compile time, and a
12
13
runtime linkage requirement to that ` soname ` is passed to the linker for
@@ -16,6 +17,9 @@ the `crateid` attributes that were declared on the external crate when it was
16
17
compiled. If no ` crateid ` is provided, a default ` name ` attribute is assumed,
17
18
equal to the [ identifier] given in the ` extern crate ` declaration.
18
19
20
+ The ` self ` crate may be imported which creates a binding to the current crate.
21
+ In this case the ` as ` clause must be used to specify the name to bind it to.
22
+
19
23
Three examples of ` extern crate ` declarations:
20
24
21
25
``` rust,ignore
You can’t perform that action at this time.
0 commit comments