Go to file
Michael Howell 5e4b67f47d
Rename C-like enum to Field-less enum
There is no need to reference the C programming language to explain this concept.
2017-11-22 10:50:20 -07:00
.github Update contributing info 2017-03-26 11:38:00 -04:00
ci Adding some signposts in; I'm having trouble seeing why the build's failing 2017-11-13 13:23:28 -05:00
first-edition Rename C-like enum to Field-less enum 2017-11-22 10:50:20 -07:00
redirects Make a few small corrections to the redirect pages 2017-11-03 12:08:11 -04:00
second-edition Replace ...snip... with --snip-- everywhere 2017-11-21 14:27:13 -05:00
.gitattributes Mark png as binary 2017-03-31 15:30:48 -04:00
.gitignore
.travis.yml We should build/test with the same version of mdbook rust-lang/rust uses 2017-11-13 13:20:05 -05:00
CONTRIBUTING.md Make info about documenting newly stabilized features more obvious 2017-05-13 10:02:49 -04:00
COPYRIGHT COPYRIGHT: hoedown is no longer used 2017-04-06 21:56:44 +08:00
LICENSE-APACHE
LICENSE-MIT
README.md Specify that mdbook version should really match what rust-lang/rust is using 2017-10-26 12:32:51 -04:00
index.md Fix punctuation in introductory explanation of 2nd edition 2017-05-21 10:57:37 +02:00

README.md

The Rust Programming Language

Build Status

This repo contains two editions of “The Rust Programming Language”.

The second edition is a rewrite that will be printed by NoStarch Press, available around October 2017.

You can read it online; the last few chapters aren't completed yet, but the first half of the book is much improved from the first edition. We recommend starting with the second edition.

The first edition is still available to read online.

Requirements

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

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

Building

To build the book, first cd into either the first-edition or second-edition directory depending on which edition of the book you would like to build. Then 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 especially love help translating the second edition of 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! The chapters in the frozen column of the project won't see major changes, so if you start with those, you won't have to redo work :)

No Starch

As the second edition of the book will be published by No Starch, we first iterate here, then ship the text off to No Starch. Then they do editing, and we fold it back in.

As such, theres a directory, nostarch, which corresponds to the text in No Starchs system.

When we've started working with No Starch in a word doc, we will also check those into the repo in the nostarch/odt directory. To extract the text from the word doc as markdown in order to backport changes to the online book:

  1. Open the doc file in LibreOffice
  2. Accept all tracked changes
  3. Save as Microsoft Word 2007-2013 XML (.docx) in the tmp directory
  4. Run ./doc-to-md.sh
  5. Inspect changes made to the markdown file in the nostarch directory and copy the changes to the src directory as appropriate.

Graphviz dot

This is mostly for Carol's reference because she keeps having to look it up.

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).