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.
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 ;-)
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.
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). The vast majority of existing
27 // languages sacrifices one of these goals for the other. In particular, the
28 // first requirement rules out a garbage collector: Rust can run "bare metal".
29 // In fact, Rust rules out more classes of bugs than languages that achieve safety
30 // with a GC: Besides dangling pointers and double-free, Rust also prevents issues
31 // such as iterator invalidation and data races.
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*).
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).
47 // There is a workspace prepared for you in the `workspace` folder. I suggest you copy this
48 // folder somewhere else - that will make it much easier to later update the course without
49 // overwriting your changes. Try `cargo build` in that new folder to check that compiling your workspace succeeds.
50 // (You can also execute it with `cargo run`, but you'll need to do some work before this will succeed.)
52 // If you later want to update the course, do `git pull` (or re-download the zip archive).
53 // Then copy the files from `workspace/src/` to your workspace that you did not yet work on. Definitely
54 // copy `main.rs` to make sure all the new files are actually compiled. (Of course you can also
55 // copy the rest, but that would replace all your hard work by the original files with all the holes!)
60 // Open `your-workspace/src/part00.rs` in your favorite editor, and follow the link below for
61 // the explanations and exercises. You are ready to start. Have fun!
65 // * [Part 00: Algebraic datatypes](part00.html)
66 // * [Part 01: Expressions, Inherent methods](part01.html)
67 // * [Part 02: Generic types, Traits](part02.html)
68 // * [Part 03: Input](part03.html)
72 // * [Part 04: Ownership, Borrowing](part04.html)
73 // * [Part 05: Clone](part05.html)
74 // * [Part 06: Copy, Lifetimes](part06.html)
75 // * [Part 07: Operator Overloading, Tests, Formating](part07.html)
76 // * [Part 08: Associated Types, Modules](part08.html)
77 // * [Part 09: Iterators](part09.html)
78 // * [Part 10: Closures](part10.html)
82 // * [Part 11: Trait Objects, Box, Lifetime bounds](part11.html)
83 // * [Part 12: Rc, Interior Mutability, Cell, RefCell](part12.html)
84 // * [Part 13: Concurrency, Arc, Send](part13.html)
85 // * [Part 14: Slices, Arrays, External Dependencies](part14.html)
86 // * [Part 15: Mutex, Interior Mutability (cont.), RwLock, Sync](part15.html)
87 // * [Part 16: Unsafe Rust, Drop](part16.html)
89 #![allow(dead_code, unused_imports, unused_variables, unused_mut, unreachable_code)]
108 // To actually run the code of some part (after filling in the blanks, if necessary), simply edit the `main`
115 // Additional material
116 // -------------------
118 // There's tons of useful Rust stuff out there, so let me just put links to some
119 // of the most interesting places here:
121 // * [The Rust Book](https://doc.rust-lang.org/stable/book/)
122 // * [Rust by Example](http://rustbyexample.com/)
123 // * The [Rust Subreddit](https://www.reddit.com/r/rust/)
124 // * For the IRC channel and other forums, see the "Community" section of the [Rust Documentation index](http://doc.rust-lang.org/index.html)