|
| 1 | +% Rust Guidelines [working title] |
| 2 | + |
| 3 | +This document collects the emerging principles, conventions, abstractions, and |
| 4 | +best practices for writing Rust code. |
| 5 | + |
| 6 | +Since Rust is evolving at a rapid pace, these guidelines are |
| 7 | +preliminary. The hope is that writing them down explicitly will help |
| 8 | +drive discussion, consensus and adoption. |
| 9 | + |
| 10 | +Whenever feasible, guidelines provide specific examples from Rust's standard |
| 11 | +libraries. |
| 12 | + |
| 13 | +For now, you can find a rendered snapshot at |
| 14 | +[http://aturon.github.io/](http://aturon.github.io/). After |
| 15 | +[some infrastructure work](https://github.com/aturon/rust-guidelines/issues/17), the snapshot will move somewhere more |
| 16 | +official. |
| 17 | + |
| 18 | +### Building the document |
| 19 | + |
| 20 | +Like http://rustbyexample.com/, this guidelines document is written in |
| 21 | +the [`gitbook`](https://github.com/GitbookIO/gitbook) style. It can be |
| 22 | +compiled with a prototype tool, |
| 23 | +[`rustbook`](https://github.com/aturon/rust-book) that provides a |
| 24 | +minimal subset of `gitbook`'s functionality on top of `rustdoc`. |
| 25 | + |
| 26 | +### Guideline statuses |
| 27 | + |
| 28 | +Every guideline has a status: |
| 29 | + |
| 30 | +* **[FIXME]**: Marks places where there is more work to be done. In |
| 31 | + some cases, that just means going through the RFC process. |
| 32 | + |
| 33 | +* **[FIXME #NNNNN]**: Like **[FIXME]**, but links to the issue tracker. |
| 34 | + |
| 35 | +* **[RFC #NNNN]**: Marks accepted guidelines, linking to the rust-lang |
| 36 | + RFC establishing them. |
| 37 | + |
| 38 | +### Guideline stabilization |
| 39 | + |
| 40 | +One purpose of these guidelines is to reach decisions on a number of |
| 41 | +cross-cutting API and stylistic choices. Discussion and development of |
| 42 | +the guidelines will happen primarily on http://discuss.rust-lang.org/, |
| 43 | +using the Guidelines category. Discussion can also occur on the |
| 44 | +[guidelines issue tracker](https://github.com/rust-lang/rust-guidelines). |
| 45 | + |
| 46 | +Guidelines that are under development or discussion will be marked with the |
| 47 | +status **[FIXME]**, with a link to the issue tracker when appropriate. |
| 48 | + |
| 49 | +Once a concrete guideline is ready to be proposed, it should be filed |
| 50 | +as an [FIXME: needs RFC](https://github.com/rust-lang/rfcs). If the RFC is |
| 51 | +accepted, the official guidelines will be updated to match, and will |
| 52 | +include the tag **[RFC #NNNN]** linking to the RFC document. |
| 53 | + |
| 54 | +### What's in this document |
| 55 | + |
| 56 | +This document is broken into four parts: |
| 57 | + |
| 58 | +* **[Style](style/README.md)** provides a set of rules governing naming conventions, |
| 59 | + whitespace, and other stylistic issues. |
| 60 | + |
| 61 | +* **[Guidelines by Rust feature](features/README.md)** places the focus on each of |
| 62 | + Rust's features, starting from expressions and working the way out toward |
| 63 | + crates, dispensing guidelines relevant to each. |
| 64 | + |
| 65 | +* **Topical guidelines and patterns**. The rest of the document proceeds by |
| 66 | + cross-cutting topic, starting with |
| 67 | + [Ownership and resources](ownership/README.md). |
| 68 | + |
| 69 | +* **[APIs for a changing Rust](changing/README.md)** |
| 70 | + discusses the forward-compatibility hazards, especially those that interact |
| 71 | + with the pre-1.0 library stabilization process. |
| 72 | + |
| 73 | +> **[FIXME]** Add cross-references throughout this document to the tutorial, |
| 74 | +> reference manual, and other guides. |
| 75 | +
|
| 76 | +> **[FIXME]** What are some _non_-goals, _non_-principles, or _anti_-patterns that |
| 77 | +> we should document? |
0 commit comments