1
1
# Introduction
2
2
3
- This document is the primary reference for the Rust programming language. It
3
+ This book is the primary reference for the Rust programming language. It
4
4
provides three kinds of material:
5
5
6
6
- Chapters that informally describe each language construct and their use.
@@ -9,38 +9,133 @@ provides three kinds of material:
9
9
- Appendix chapters providing rationale and references to languages that
10
10
influenced the design.
11
11
12
- This document does not serve as an introduction to the language. Background
12
+ > ** Note** : You may also be interested in the [ grammar] .
13
+
14
+ <div class =" warning " >
15
+
16
+ Warning: This book is incomplete. Documenting everything takes a while. See
17
+ the [ undocumented] page for what is not documented in this book.
18
+
19
+ </div >
20
+
21
+ ## What * The Reference* is Not
22
+
23
+ This book does not serve as an introduction to the language. Background
13
24
familiarity with the language is assumed. A separate [ book] is available to
14
25
help acquire such background familiarity.
15
26
16
- This document also does not serve as a reference to the [ standard] library
27
+ This book also does not serve as a reference to the [ standard library]
17
28
included in the language distribution. Those libraries are documented
18
29
separately by extracting documentation attributes from their source code. Many
19
30
of the features that one might expect to be language features are library
20
31
features in Rust, so what you're looking for may be there, not here.
21
32
22
- This document also only serves as a reference to what is available in stable
23
- Rust. For unstable features being worked on, see the [ Unstable Book] . This was
24
- a recent change in scope, so unstable features are still documented, but are
25
- in the process of being removed.
33
+ Similarly, this book does not usually document the specifics of ` rustc ` as a
34
+ tool or of Cargo. ` rustc ` has its own [ book] [ rustc book ] . Cargo has a
35
+ [ book] [ cargo book ] that contains a [ reference] [ cargo reference ] . There are a few
36
+ pages such as [ linkage] that still describe how ` rustc ` works.
37
+
38
+ This book also only serves as a reference to what is available in stable
39
+ Rust. For unstable features being worked on, see the [ Unstable Book] .
26
40
27
- Finally, this document is not normative. It may include details that are
41
+ Finally, this book is not normative. It may include details that are
28
42
specific to ` rustc ` itself, and should not be taken as a specification for
29
- the Rust language. We intend to produce such a document someday, but this
30
- is what we have for now.
43
+ the Rust language. We intend to produce such a book someday, and until then,
44
+ the reference is the closest thing we have to one.
45
+
46
+ ## How to Use This Book
47
+
48
+ This book does not assume you are reading this book sequentially. Each
49
+ chapter generally can be read standalone, but will cross-link to other chapters
50
+ for facets of the language they refer to, but do not discuss.
51
+
52
+ There are two main ways to read this document.
53
+
54
+ The first is to answer a specific question. If you know which chapter answers
55
+ that question, you can jump to that chapter in the table of contents. Otherwise,
56
+ you can press ` s ` or the click the magnifying glass on the top bar to search for
57
+ keywords related to your question. For example, say you wanted to know when a
58
+ temporary value created in a let statement is dropped. If you didn't already
59
+ know that the [ lifetime of temporaries] is defined in the [ expressions chapter] ,
60
+ you could search "temporary let" and the first search result will take you to
61
+ that section.
62
+
63
+ The second is to generally improve your knowledge of a facet of the language.
64
+ In that case, just browse the table of contents until you see something you
65
+ want to know more about, and just start reading. If a link looks interesting,
66
+ click it, and read about that section.
67
+
68
+ That said, there is no wrong way to read this book. Read it however you feel
69
+ helps you best.
70
+
71
+ ### Conventions
72
+
73
+ Like all technical books, this book has certain conventions in how it displays
74
+ information. These conventions are documented here.
75
+
76
+ * Statements that define a term contain that term in * italics* . Whenever that
77
+ term is used outside of that chapter, it is usually a link to the section that
78
+ has this definition.
79
+
80
+ An * example term* is an example of a term beind defined.
81
+
82
+ * Notes that contain useful information about the state of the book or point out
83
+ useful, but mostly out of scope, information are in blockquotes that start
84
+ with the word "Note:" in ** bold** .
85
+
86
+ > ** Note** : This is an example note.
87
+
88
+ * Warnings that show unsound behavior in the language or possibly confusing
89
+ interactions of language features are in a special warning box.
90
+
91
+ <div class =" warning " >
92
+
93
+ Warning: This is an example warning.
94
+
95
+ </div >
96
+
97
+ * Code snippets inline in the text are inside ` <code> ` tags.
98
+
99
+ Longer code examples are in a syntax highlighted box that has controls for
100
+ copying, executing, and showing hidden lines in the top right corner.
101
+
102
+ ``` rust
103
+ # // This is a hidden line.
104
+ fn main () {
105
+ println! (" This is a code example" );
106
+ }
107
+ ```
108
+
109
+ * The grammar and lexical structure is in blockquotes with either "Lexer" or
110
+ "Syntax" in <sup >** bold superscript** </sup > as the first line.
111
+
112
+ > ** <sup >Syntax</sup >** \
113
+ > _ ExampleGrammar_ :\
114
+ >   ;  ;   ;  ; ` ~ ` [ _ Expression_ ] \
115
+ >   ;  ; | ` box ` [ _ Expression_ ]
31
116
32
- You may also be interested in the [ grammar ] .
117
+ ## Contributing
33
118
34
- You can contribute to this document by opening an issue or sending a pull
35
- request to [ the Rust Reference repository] .
119
+ We welcome contributions of all kinds.
36
120
37
- N. B. This document may be incomplete. Documenting everything might take a
38
- while. We have a [ big issue] to track documentation for every Rust feature,
39
- so check that out if you can't find something here.
121
+ You can contribute to this book by opening an issue or sending a pull
122
+ request to [ the Rust Reference repository] . If this book does not answer
123
+ your question, and you think its answer is in scope of it, please do not
124
+ hesitate to file an issue or ask about it in the Rust docs channels on IRC or
125
+ discord. Knowing what people use this book for the most helps direct our
126
+ attention to making those sections the best that they can be.
40
127
41
128
[ book ] : ../book/index.html
42
- [ standard ] : ../std/index.html
129
+ [ standard library ] : ../std/index.html
43
130
[ grammar ] : ../grammar.html
44
131
[ the Rust Reference repository ] : https://github.com/rust-lang-nursery/reference/
45
132
[ big issue ] : https://github.com/rust-lang-nursery/reference/issues/9
46
- [ Unstable Book ] : https://doc.rust-lang.org/nightly/unstable-book/
133
+ [ Unstable Book ] : https://doc.rust-lang.org/nightly/unstable-book/
134
+ [ _Expression_ ] : expressions.html
135
+ [ cargo book ] : ../cargo/index.html
136
+ [ cargo reference ] : ../cargo/reference/index.html
137
+ [ expressions chapter ] : expressions.html
138
+ [ lifetime of temporaries ] : expressions.html#temporary-lifetimes
139
+ [ linkage ] : linkage.html
140
+ [ rustc book ] : ../rustc/index.html
141
+ [ undocumented ] : undocumeted.html
0 commit comments