Skip to content

Commit 18718cc

Browse files
committed
Conventions and more on how to use this book
1 parent 098e9e4 commit 18718cc

File tree

1 file changed

+73
-7
lines changed

1 file changed

+73
-7
lines changed

src/introduction.md

+73-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ provides three kinds of material:
99
- Appendix chapters providing rationale and references to languages that
1010
influenced the design.
1111

12-
You may also be interested in the [grammar].
12+
> **Note**: You may also be interested in the [grammar].
1313
1414
<div class="warning">
1515

@@ -44,13 +44,76 @@ specific to `rustc` itself, and should not be taken as a specification for
4444
the Rust language. We intend to produce such a document someday, and until then,
4545
the reference is the closest thing we have to one.
4646

47-
## How to Read The Reference
47+
## How to Use This Book
4848

49-
You sould not read this document sequentially. As a reference document, you
50-
should skim the table of contents until you find the section you are interested
51-
in and read that section. If you are viewing this in a browser and have
52-
JavaScript enabled, you can also press `s` or click the magnifying glass on the
53-
top bar to open a search bar.
49+
This book does not assume you are reading this document sequentially. Each
50+
chapter generally can be read standalone, but will cross-link to other chapters
51+
for facets of the language they refer to, but do not discuss.
52+
53+
There are two main ways to read this document.
54+
55+
The first is to answer a specific question. If you know which chapter answers
56+
that question, you can jump to that chapter in the table of contents. Otherwise,
57+
you can press `s` or the click the magnifying glass on the top bar to search for
58+
keywords related to your question. For example, say you wanted to know when a
59+
temporary value created in a let statement is dropped. If you didn't already
60+
know that the [lifetime of temporaries] is defined in the [expressions chapter],
61+
you could search "temporary let" and the first search result will take you to
62+
that section.
63+
64+
The second is to generally improve your knowledge of a facet of the language.
65+
In that case, just browse the table of contents until you see something you
66+
want to know more about, and just start reading. If a link looks interesting,
67+
click it, and read about that section.
68+
69+
That said, there is no wrong way to read this book. Read it however you feel
70+
helps you best.
71+
72+
### Conventions
73+
74+
Like all technical books, this book has certain conventions in how it displays
75+
information. These conventions are documented here.
76+
77+
* Statements that define a term contain that term in *italics*. Whenever that
78+
term is used outside of that chapter, it is usually a link to the section that
79+
has this definition.
80+
81+
An *example term* is an example of a term beind defined.
82+
83+
* Notes that contain useful information about the state of the book or point out
84+
useful, but mostly out of scope, information are in blockquotes that start with
85+
the word "Note:" in **bold**.
86+
87+
> Note: This is an example note.
88+
89+
* Warnings that show unsound behavior in the language or possibly confusing
90+
interactions of language features are in a special warning box.
91+
92+
<div class="warning">
93+
94+
Warning: This is an example warning.
95+
96+
</div>
97+
98+
* Code snippets inline in the text are inside `<code>` tags.
99+
100+
Longer code examples are in a syntax highlighted box that has controls for
101+
copying, executing, and showing hidden lines in the top right corner.
102+
103+
```rust
104+
# // This is a hidden line.
105+
fn main() {
106+
println!("This is a code example");
107+
}
108+
```
109+
110+
* The grammar and lexical structure is in blockquotes with either "Lexer" or
111+
"Syntax" in **bold** as the first line in <sup>superscript</sup>.
112+
113+
> **<sup>Syntax</sup>**\
114+
> _ExampleGrammar_:\
115+
> &nbsp;&nbsp; &nbsp;&nbsp; `~` [_Expression_]\
116+
> &nbsp;&nbsp; | `box` [_Expression_]
54117
55118
## Contributing
56119

@@ -69,6 +132,9 @@ attention to making those sections the best that they can be.
69132
[the Rust Reference repository]: https://github.com/rust-lang-nursery/reference/
70133
[big issue]: https://github.com/rust-lang-nursery/reference/issues/9
71134
[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/
135+
[_Expression_]: expressions.html
72136
[cargo book]: ../cargo/index.html
73137
[cargo reference]: ../cargo/reference/index.html
138+
[expressions chapter]: expressions.html
139+
[lifetime of temporaries]: expressions.html#temporary-lifetimes
74140
[linkage]: linkage.html

0 commit comments

Comments
 (0)