work on Intro; import code from previous parts where appropriate
[rust-101.git] / src / main.rs
1 // Welcome to Rust-101
2 // ===================
3 // 
4 // This is [Rust-101](https://www.ralfj.de/projects/rust-101/), a small *work-in-progress*
5 // tutorial for the [Rust language](http://www.rust-lang.org/).
6 // It is intended to be an interactive, hands-on course: I believe the only way to
7 // *really* learn a language is to write code in it, so you should be coding during
8 // the course. I am writing this with a tutorial situation in mind, i.e.,
9 // with a teacher being around to guide students through the course and answer
10 // questions as they come up. However, I think they may also be useful if you
11 // work through them on your own, you will just have to show more initiative yourself:
12 // Make sure you actually type some code. It may sound stupid to manually copy code
13 // that you could duplicate through the clipboard, but it's actually helpful.
14 // If you have questions, check out the "Additional Resources" below. In particular,
15 // the IRC channel is filled with awesome people willing to help you! I spent
16 // lots of time there ;-)
17 // 
18 // I will assume some familiarity with programming, and hence not explain the basic
19 // concepts common to most languages. Instead, I will focus on what makes Rust special.
20 //
21 // Why Rust?
22 // ---------
23 // 
24 // When you got here, I am kind of assuming that you already decided to give Rust at
25 // least a look, so that I don't have to do much convincing here ;-) . But just in
26 // case, here's why I think Rust is worth learning:<br/>
27 // At this time, Rust is a language with a pretty unique set of goals. Rust aims to
28 // achieve C++-style control over memory and execution behavior (like, static vs. dynamic
29 // dispatch), which makes it possible to construct abstractions that carry no run-time
30 // cost. This is combined this with providing the comfort of high-level functional languages
31 // and guaranteeing safety (as in, the program will not crash). The vast majority of existing
32 // languages sacrificies one of these goals for the other. In particular, the
33 // first requirement rules out a garbage collector: Rust can run "mare metal".
34 // In fact, Rust rules out more classes of bugs than languages that achieve safety
35 // with a GC: Besides dangling pointers and double-free, Rust also prevents issues
36 // such as iterator invalidation and race conditions.
37 // 
38 // 
39 // Prerequisites
40 // -------------
41 // 
42 // You will need to have Rust installed, of course. It is available for download on
43 // [the Rust website](http://www.rust-lang.org/). At this point, I plan to restrict
44 // myself to stable Rust, so "Recommended" version is just right.
45 // You can find some more installation instructions in
46 // [the second chapter of The Book](https://doc.rust-lang.org/stable/book/installing-rust.html).
47 // When you are done, running `cargo build` in the root of Rust-101 should successfully compile
48 // all the code.
49 // 
50 // Getting the source
51 // ------------------
52 // 
53 // You are meant to play around with the source code of the course as you go on, so please
54 // fetch it from the [git repository](http://www.ralfj.de/git/rust-101.git) (also available
55 // [on GitHub](https://github.com/RalfJung/rust-101)).
56 // 
57 // Course Content
58 // --------------
59 // 
60 // The actual course is in the partXX.rs files. The part 00-03 cover some basic of the language,
61 // to give you a feeling for Rust's syntax and pervasive mechanisms like pattern matching and traits.
62 // Parts 04-?? introduce the heart of the language, the mechanism making it different from anything
63 // else out there.
64 // 
65 // I suggest you get started with [the first part](part00.html), or jump directly to where you left off:
66 // 
67 // * [Part 00](part00.html)
68 // * [Part 01](part01.html)
69 // * [Part 02](part02.html)
70 // * [Part 03](part03.html)
71 // * [Part 04](part04.html) (WIP)
72 // * (to be continued)
73 #![allow(dead_code, unused_imports, unused_variables)]
74 mod part00;
75 mod part01;
76 mod part02;
77 mod part03;
78 mod part04;
79 mod part05;
80 mod part06;
81
82 // To actually run the code of some part (after filling in the blanks, if necessary), simply edit the `main`
83 // function.
84
85 fn main() {
86     part00::main();
87 }
88
89 // Additional material
90 // -------------------
91 // 
92 // There's tons of useful Rust stuff out there, so let me just put links to some
93 // of the most interesting places here:
94 // 
95 // * [The Rust Book](https://doc.rust-lang.org/stable/book/)
96 // * [Rust by Example](http://rustbyexample.com/)
97 // * The [Rust Subreddit](https://www.reddit.com/r/rust/)
98 // * For the IRC channel and other forums, see the "Community" section of the [Rust Documentation index](http://doc.rust-lang.org/index.html)