-
Notifications
You must be signed in to change notification settings - Fork 533
Improve Introduction #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Improve Introduction #408
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
edf6c62
Expand the introduction.
Havvy 9d4b36d
Add structure (headers) to introduction
Havvy c2da832
Conventions and more on how to use this book
Havvy 3f63884
Change 'this document' to 'this book' in introduction
Havvy b6600c4
rustc has a book. Fix typo
Havvy 0d7a062
Adress Matthew Jasper's comments
Havvy 6c13d8e
Bold the word superscript too
Havvy 99134b2
Typo: book the => document the
Havvy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Introduction | ||
|
||
This document is the primary reference for the Rust programming language. It | ||
This book is the primary reference for the Rust programming language. It | ||
provides three kinds of material: | ||
|
||
- Chapters that informally describe each language construct and their use. | ||
|
@@ -9,38 +9,133 @@ provides three kinds of material: | |
- Appendix chapters providing rationale and references to languages that | ||
influenced the design. | ||
|
||
This document does not serve as an introduction to the language. Background | ||
> **Note**: You may also be interested in the [grammar]. | ||
|
||
<div class="warning"> | ||
|
||
Warning: This book is incomplete. Documenting everything takes a while. See | ||
the [undocumented] page for what is not documented in this book. | ||
|
||
</div> | ||
|
||
## What *The Reference* is Not | ||
|
||
This book does not serve as an introduction to the language. Background | ||
familiarity with the language is assumed. A separate [book] is available to | ||
help acquire such background familiarity. | ||
|
||
This document also does not serve as a reference to the [standard] library | ||
This book also does not serve as a reference to the [standard library] | ||
included in the language distribution. Those libraries are documented | ||
separately by extracting documentation attributes from their source code. Many | ||
of the features that one might expect to be language features are library | ||
features in Rust, so what you're looking for may be there, not here. | ||
|
||
This document also only serves as a reference to what is available in stable | ||
Rust. For unstable features being worked on, see the [Unstable Book]. This was | ||
a recent change in scope, so unstable features are still documented, but are | ||
in the process of being removed. | ||
Similarly, this book does not usually book the specifics of `rustc` as a | ||
tool or of Cargo. `rustc` has its own [book][rustc book]. Cargo has a | ||
[book][cargo book] that contains a [reference][cargo reference]. There are a few | ||
pages such as [linkage] that still describe how `rustc` works. | ||
|
||
This book also only serves as a reference to what is available in stable | ||
Rust. For unstable features being worked on, see the [Unstable Book]. | ||
|
||
Finally, this document is not normative. It may include details that are | ||
Finally, this book is not normative. It may include details that are | ||
specific to `rustc` itself, and should not be taken as a specification for | ||
the Rust language. We intend to produce such a document someday, but this | ||
is what we have for now. | ||
the Rust language. We intend to produce such a book someday, and until then, | ||
the reference is the closest thing we have to one. | ||
|
||
## How to Use This Book | ||
|
||
This book does not assume you are reading this book sequentially. Each | ||
chapter generally can be read standalone, but will cross-link to other chapters | ||
for facets of the language they refer to, but do not discuss. | ||
|
||
There are two main ways to read this document. | ||
|
||
The first is to answer a specific question. If you know which chapter answers | ||
that question, you can jump to that chapter in the table of contents. Otherwise, | ||
you can press `s` or the click the magnifying glass on the top bar to search for | ||
keywords related to your question. For example, say you wanted to know when a | ||
temporary value created in a let statement is dropped. If you didn't already | ||
know that the [lifetime of temporaries] is defined in the [expressions chapter], | ||
you could search "temporary let" and the first search result will take you to | ||
that section. | ||
|
||
The second is to generally improve your knowledge of a facet of the language. | ||
In that case, just browse the table of contents until you see something you | ||
want to know more about, and just start reading. If a link looks interesting, | ||
click it, and read about that section. | ||
|
||
That said, there is no wrong way to read this book. Read it however you feel | ||
helps you best. | ||
|
||
### Conventions | ||
|
||
Like all technical books, this book has certain conventions in how it displays | ||
information. These conventions are documented here. | ||
|
||
* Statements that define a term contain that term in *italics*. Whenever that | ||
term is used outside of that chapter, it is usually a link to the section that | ||
has this definition. | ||
|
||
An *example term* is an example of a term beind defined. | ||
|
||
* Notes that contain useful information about the state of the book or point out | ||
useful, but mostly out of scope, information are in blockquotes that start | ||
with the word "Note:" in **bold**. | ||
|
||
> **Note**: This is an example note. | ||
|
||
* Warnings that show unsound behavior in the language or possibly confusing | ||
interactions of language features are in a special warning box. | ||
|
||
<div class="warning"> | ||
|
||
Warning: This is an example warning. | ||
|
||
</div> | ||
|
||
* Code snippets inline in the text are inside `<code>` tags. | ||
|
||
Longer code examples are in a syntax highlighted box that has controls for | ||
copying, executing, and showing hidden lines in the top right corner. | ||
|
||
```rust | ||
# // This is a hidden line. | ||
fn main() { | ||
println!("This is a code example"); | ||
} | ||
``` | ||
|
||
* The grammar and lexical structure is in blockquotes with either "Lexer" or | ||
"Syntax" in <sup>**bold superscript**</sup> as the first line. | ||
|
||
> **<sup>Syntax</sup>**\ | ||
> _ExampleGrammar_:\ | ||
> `~` [_Expression_]\ | ||
> | `box` [_Expression_] | ||
|
||
You may also be interested in the [grammar]. | ||
## Contributing | ||
|
||
You can contribute to this document by opening an issue or sending a pull | ||
request to [the Rust Reference repository]. | ||
We welcome contributions of all kinds. | ||
|
||
N. B. This document may be incomplete. Documenting everything might take a | ||
while. We have a [big issue] to track documentation for every Rust feature, | ||
so check that out if you can't find something here. | ||
You can contribute to this book by opening an issue or sending a pull | ||
request to [the Rust Reference repository]. If this book does not answer | ||
your question, and you think its answer is in scope of it, please do not | ||
hesitate to file an issue or ask about it in the Rust docs channels on IRC or | ||
discord. Knowing what people use this book for the most helps direct our | ||
attention to making those sections the best that they can be. | ||
|
||
[book]: ../book/index.html | ||
[standard]: ../std/index.html | ||
[standard library]: ../std/index.html | ||
[grammar]: ../grammar.html | ||
[the Rust Reference repository]: https://github.com/rust-lang-nursery/reference/ | ||
[big issue]: https://github.com/rust-lang-nursery/reference/issues/9 | ||
[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ | ||
[Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ | ||
[_Expression_]: expressions.html | ||
[cargo book]: ../cargo/index.html | ||
[cargo reference]: ../cargo/reference/index.html | ||
[expressions chapter]: expressions.html | ||
[lifetime of temporaries]: expressions.html#temporary-lifetimes | ||
[linkage]: linkage.html | ||
[rustc book]: ../rustc/index.html | ||
[undocumented]: undocumeted.html | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be helpful to add a link to the Rustonomicon. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the second 'book' here should be 'document'