1
1
# Items
2
2
3
+ > ** <sup >Syntax:<sup >** \
4
+ > _ Item_ :\
5
+ >   ;  ; [ _ OuterAttribute_ ] <sup >\* </sup > [ _ Visibility_ ] <sup >?</sup >\
6
+ >   ;  ; (\
7
+ >   ;  ;   ;  ;   ;  ; [ _ Module_ ] \
8
+ >   ;  ;   ;  ; | [ _ ExternCrate_ ] \
9
+ >   ;  ;   ;  ; | [ _ UseDeclaration_ ] \
10
+ >   ;  ;   ;  ; | [ _ Function_ ] \
11
+ >   ;  ;   ;  ; | [ _ TypeAlias_ ] \
12
+ >   ;  ;   ;  ; | [ _ Struct_ ] \
13
+ >   ;  ;   ;  ; | [ _ Enumeration_ ] \
14
+ >   ;  ;   ;  ; | [ _ Union_ ] \
15
+ >   ;  ;   ;  ; | [ _ ConstantItem_ ] \
16
+ >   ;  ;   ;  ; | [ _ StaticItem_ ] \
17
+ >   ;  ;   ;  ; | [ _ Trait_ ] \
18
+ >   ;  ;   ;  ; | [ _ Implementation_ ] \
19
+ >   ;  ;   ;  ; | [ _ ExternBlock_ ] \
20
+ >   ;  ;   ;  ; | _ Macro_ \
21
+ >   ;  ;   ;  ; | _ MacroDefinition_ \
22
+ >   ;  ; )
23
+
3
24
An _ item_ is a component of a crate. Items are organized within a crate by a
4
25
nested set of [ modules] . Every crate has a single "outermost" anonymous module;
5
26
all further items within the crate have [ paths] within the module tree of the
6
27
crate.
7
28
8
- [ modules ] : items/modules.html
9
- [ paths ] : paths.html
10
-
11
29
Items are entirely determined at compile-time, generally remain fixed during
12
30
execution, and may reside in read-only memory.
13
31
14
32
There are several kinds of items:
15
33
16
- * [ modules] ( items/modules.html )
17
- * [ ` extern crate ` declarations] ( items/extern-crates.html )
18
- * [ ` use ` declarations] ( items/use-declarations.html )
19
- * [ function definitions] ( items/functions.html )
20
- * [ type definitions] ( items/type-aliases.html )
21
- * [ struct definitions] ( items/structs.html )
22
- * [ enumeration definitions] ( items/enumerations.html )
23
- * [ union definitions] ( items/unions.html )
24
- * [ constant items] ( items/constant-items.html )
25
- * [ static items] ( items/static-items.html )
26
- * [ trait definitions] ( items/traits.html )
27
- * [ implementations] ( items/implementations.html )
28
- * [ ` extern ` blocks] ( items/external-blocks.html )
34
+ * [ modules]
35
+ * [ ` extern crate ` declarations]
36
+ * [ ` use ` declarations]
37
+ * [ function definitions]
38
+ * [ type definitions]
39
+ * [ struct definitions]
40
+ * [ enumeration definitions]
41
+ * [ union definitions]
42
+ * [ constant items]
43
+ * [ static items]
44
+ * [ trait definitions]
45
+ * [ implementations]
46
+ * [ ` extern ` blocks]
29
47
30
48
Some items form an implicit scope for the declaration of sub-items. In other
31
49
words, within a function or module, declarations of items can (in many cases)
@@ -36,3 +54,33 @@ as if the item was declared outside the scope — it is still a static item
36
54
qualified by the name of the enclosing item, or is private to the enclosing
37
55
item (in the case of functions). The grammar specifies the exact locations in
38
56
which sub-item declarations may appear.
57
+
58
+ [ _ConstantItem_ ] : items/constant-items.html
59
+ [ _Enumeration_ ] : items/enumerations.html
60
+ [ _ExternBlock_ ] : items/external-blocks.html
61
+ [ _ExternCrate_ ] : items/extern-crates.html
62
+ [ _Function_ ] : items/functions.html
63
+ [ _Implementation_ ] : items/implementations.html
64
+ [ _Module_ ] : items/modules.html
65
+ [ _OuterAttribute_ ] : attributes.html
66
+ [ _StaticItem_ ] : items/static-items.html
67
+ [ _Struct_ ] : items/structs.html
68
+ [ _Trait_ ] : items/traits.html
69
+ [ _TypeAlias_ ] : items/type-aliases.html
70
+ [ _Union_ ] : items/unions.html
71
+ [ _UseDeclaration_ ] : items/use-declarations.html
72
+ [ _Visibility_ ] : visibility-and-privacy.html
73
+ [ `extern crate` declarations ] : items/extern-crates.html
74
+ [ `extern` blocks ] : items/external-blocks.html
75
+ [ `use` declarations ] : items/use-declarations.html
76
+ [ constant items ] : items/constant-items.html
77
+ [ enumeration definitions ] : items/enumerations.html
78
+ [ function definitions ] : items/functions.html
79
+ [ implementations ] : items/implementations.html
80
+ [ modules ] : items/modules.html
81
+ [ paths ] : paths.html
82
+ [ static items ] : items/static-items.html
83
+ [ struct definitions ] : items/structs.html
84
+ [ trait definitions ] : items/traits.html
85
+ [ type definitions ] : items/type-aliases.html
86
+ [ union definitions ] : items/unions.html
0 commit comments