feedback from Alexis. Thanks!
[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 tutorial for
5 // the [Rust language](http://www.rust-lang.org/). It is intended to be an interactive,
6 // hands-on course: I believe the only way to *really* learn a language is to write code
7 // in it, so you should be coding during the course.
8 // 
9 // If you have any questions that are not answered here, check out the "Additional Resources"
10 // below. In particular, the IRC channel is filled with awesome people willing to help you! I spent
11 // lots of time there ;-)
12 // 
13 // I will assume some familiarity with programming, and hence not explain the basic
14 // concepts common to most languages. Instead, I will focus on what makes Rust special.
15 //
16 // Why Rust?
17 // ---------
18 // 
19 // When you got here, I am kind of assuming that you already decided to give Rust at
20 // least a look, so that I don't have to do much convincing here. But just in
21 // case, here's why I think Rust is worth learning:<br/>
22 // At this time, Rust is a language with a pretty unique set of goals. Rust aims to
23 // achieve C++-style control over memory and execution behavior (like, static vs. dynamic
24 // dispatch), which makes it possible to construct abstractions that carry no run-time
25 // cost. This is combined with the comfort of high-level functional languages and guaranteed
26 // safety (as in, the program will not crash in uncontrolled ways). The vast majority of existing
27 // languages sacrifices control for safety (for example, by enforcing the usage of
28 // a garbage collector) or vice versa. Rust can run without dynamic allocation (i.e., without
29 // a heap), and even without an operating system. In fact, Rust rules out more classes of bugs
30 // than languages that achieve safety with a garbage collector: Besides dangling pointers and
31 // double-free, Rust also prevents issues such as iterator invalidation and data races.
32 // 
33 // 
34 // Getting started
35 // ---------------
36 // 
37 // You will need to have Rust installed, of course. It is available for download on
38 // [the Rust website](http://www.rust-lang.org/). Make sure you get at least version 1.2
39 // (at the time of writing, that's the current beta release). More detailed installation
40 // instructions are provided in [the second chapter of The Book](https://doc.rust-lang.org/stable/book/installing-rust.html).
41 // This will also install `cargo`, the tool responsible for building rust projects (or *crates*).
42 // 
43 // Next, fetch the Rust-101 source code from the [git repository](http://www.ralfj.de/git/rust-101.git)
44 // (also available [on GitHub](https://github.com/RalfJung/rust-101), and as a
45 // [zip archive](https://github.com/RalfJung/rust-101/archive/master.zip) in case you don't have git installed).
46 // 
47 // There is a workspace prepared for you in the `workspace` folder. I suggest you copy this
48 // folder somewhere else. Try `cargo build` in that new folder to check that compiling your workspace succeeds.
49 // (You can also execute it with `cargo run`, but you'll need to do some work before this will succeed.)
50
51 // Course Content
52 // --------------
53 // 
54 // Open `your-workspace/src/part00.rs` in your favorite editor, and follow the link below for
55 // the explanations and exercises. You are ready to start. Have fun!
56 // 
57 // ### Introduction
58 //
59 // * [Part 00: Algebraic datatypes](part00.html)
60 // * [Part 01: Expressions, Inherent methods](part01.html)
61 // * [Part 02: Generic types, Traits](part02.html)
62 // * [Part 03: Input](part03.html)
63 // 
64 // ### Basic Rust
65 // 
66 // * [Part 04: Ownership, Borrowing](part04.html)
67 // * [Part 05: Clone](part05.html)
68 // * [Part 06: Copy, Lifetimes](part06.html)
69 // * [Part 07: Operator Overloading, Tests, Formating](part07.html)
70 // * [Part 08: Associated Types, Modules](part08.html)
71 // * [Part 09: Iterators](part09.html)
72 // * [Part 10: Closures](part10.html)
73 // 
74 // ### Advanced Rust
75 // 
76 // * [Part 11: Trait Objects, Box, Lifetime bounds](part11.html)
77 // * [Part 12: Rc, Interior Mutability, Cell, RefCell](part12.html)
78 // * [Part 13: Concurrency, Arc, Send](part13.html)
79 // * [Part 14: Slices, Arrays, External Dependencies](part14.html)
80 // * [Part 15: Mutex, Interior Mutability (cont.), RwLock, Sync](part15.html)
81 // * [Part 16: Unsafe Rust, Drop](part16.html)
82 // 
83 #![allow(dead_code, unused_imports, unused_variables, unused_mut, unreachable_code)]
84 mod part00;
85 mod part01;
86 mod part02;
87 mod part03;
88 mod part04;
89 mod part05;
90 mod part06;
91 mod part07;
92 mod part08;
93 mod part09;
94 mod part10;
95 mod part11;
96 mod part12;
97 mod part13;
98 mod part14;
99 mod part15;
100 mod part16;
101
102 // To actually run the code of some part (after filling in the blanks, if necessary), simply edit the `main`
103 // function.
104 fn main() {
105     part00::main();
106 }
107
108
109 // Additional material
110 // -------------------
111 // 
112 // There's tons of useful Rust stuff out there, so let me just put links to some
113 // of the most interesting places here:
114 // 
115 // * [The Rust Book](https://doc.rust-lang.org/stable/book/)
116 // * [The Rustonomicon](https://doc.rust-lang.org/nightly/nomicon/)
117 // * [Rust by Example](http://rustbyexample.com/)
118 // * The [Rust Subreddit](https://www.reddit.com/r/rust/)
119 // * A [collection of links](https://github.com/ctjhoa/rust-learning) to blog posts, articles, videos, etc. for learning Rust.
120 // * For the IRC channel and other forums, see the "Community" section of the [Rust Documentation index](http://doc.rust-lang.org/index.html)