Go to file
Carol (Nichols || Goulding) 6579c05cb9
Include code without hidden lines for nostarch files
2020-01-20 15:40:15 -05:00
.cargo Set cargo new config vars to placeholders for example projects 2020-01-20 15:39:50 -05:00
2018-edition Remove duplicate copies of tools, licenses, Cargo.tomls 2020-01-10 16:18:54 -05:00
ci Merge pull request #1906 from crlf0710/remove_fnbox 2019-11-13 09:09:51 -08:00
dot move the book to the top level 2018-11-20 13:45:05 -05:00
first-edition More link fixes 2019-02-25 01:33:17 +00:00
redirects Remove Advanced Lifetimes section completely 2019-04-11 11:51:14 -04:00
second-edition Remove duplicate copies of tools, licenses, Cargo.tomls 2020-01-10 16:18:54 -05:00
src Renumber listings following removed listing 2020-01-20 14:38:04 -05:00
theme move the book to the top level 2018-11-20 13:45:05 -05:00
tools Include code without hidden lines for nostarch files 2020-01-20 15:40:15 -05:00
.gitattributes
.gitignore
.travis.yml Update version of mdbook used to what rust-lang/rust uses 2020-01-10 15:04:32 -05:00
CONTRIBUTING.md Update mdbook links 2019-06-16 13:03:44 +08:00
COPYRIGHT
Cargo.lock Script to generate release artifact of just the listings 2020-01-20 15:40:14 -05:00
Cargo.toml Include code without hidden lines for nostarch files 2020-01-20 15:40:15 -05:00
LICENSE-APACHE
LICENSE-MIT
README.md Document that the code listings are available on the releases tab 2020-01-10 15:04:49 -05:00
book.toml move the book to the top level 2018-11-20 13:45:05 -05:00
ferris.css move the book to the top level 2018-11-20 13:45:05 -05:00
ferris.js move the book to the top level 2018-11-20 13:45:05 -05:00
rust-toolchain Specify the rustc version we're using in a rust-toolchain file 2019-09-30 20:13:33 -04:00
style-guide.md move the book to the top level 2018-11-20 13:45:05 -05:00

README.md

The Rust Programming Language

Build Status

This repository contains the source of "The Rust Programming Language" book.

The book is available in dead-tree form from No Starch Press.

You can also read the book for free online. Please see the book as shipped with the latest stable, beta, or nightly Rust releases. Be aware that issues in those versions may have been fixed in this repository already, as those releases are updated less frequently.

See the releases to download just the code of all the code listings that appear in the book.

Requirements

Building the book requires mdBook, ideally the same 0.3.x version that rust-lang/rust uses in this file. To get it:

$ cargo install mdbook --vers [version-num]

Building

To build the book, type:

$ mdbook build

The output will be in the book subdirectory. To check it out, open it in your web browser.

Firefox:

$ firefox book/index.html                       # Linux
$ open -a "Firefox" book/index.html             # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
$ start firefox.exe .\book\index.html           # Windows (Cmd)

Chrome:

$ google-chrome book/index.html                 # Linux
$ open -a "Google Chrome" book/index.html       # OS X
$ Start-Process "chrome.exe" .\book\index.html  # Windows (PowerShell)
$ start chrome.exe .\book\index.html            # Windows (Cmd)

To run the tests:

$ mdbook test

Contributing

We'd love your help! Please see CONTRIBUTING.md to learn about the kinds of contributions we're looking for.

Translations

We'd love help translating the book! See the Translations label to join in efforts that are currently in progress. Open a new issue to start working on a new language! We're waiting on mdbook support for multiple languages before we merge any in, but feel free to start!

Graphviz dot

We're using Graphviz for some of the diagrams in the book. The source for those files live in the dot directory. To turn a dot file, for example, dot/trpl04-01.dot into an svg, run:

$ dot dot/trpl04-01.dot -Tsvg > src/img/trpl04-01.svg

In the generated SVG, remove the width and the height attributes from the svg element and set the viewBox attribute to 0.00 0.00 1000.00 1000.00 or other values that don't cut off the image.

Spellchecking

To scan source files for spelling errors, you can use the spellcheck.sh script. It needs a dictionary of valid words, which is provided in dictionary.txt. If the script produces a false positive (say, you used word BTreeMap which the script considers invalid), you need to add this word to dictionary.txt (keep the sorted order for consistency).