10.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
<h1 id="page-title">Rust Vocational Training</h1>

[Rust]( is a systems language with a strong focus on safety, efficiency and (safe) concurrency. Its development is spearheaded by Mozilla, although the vast majority of contributions to Rust come from external developers since Rust and its ecosystem are developed in the open.

Rust borrows heavily from functional programming languages to provide very expressive abstraction mechanisms. Because it is a systems language, these mechanisms are almost always zero-cost. For instance, polymorphic code has no runtime cost compared to a monomorphic version.

This concern for efficiency also means that Rust lets developers keep a very high level of control and freedom for optimizations. Rust has no Garbage Collection or any form of runtime memory inspection to decide when to free, allocate or re-use memory. But because manual memory management is almost universally regarded as dangerous, or at least very difficult to maintain, the Rust compiler has a borrow-checker which is responsible for i) proving that the input program is memory-safe (and thread-safe), and ii) generating a safe and “optimal” allocation/deallocation strategy. All of this is done **at compile-time.**

While ownership, the underlying principle of the borrow-checker, is often quite daunting for newcomers, Rust integrates this approach to memory management very nicely in the language. Huge efforts have been deployed to make this mechanism as natural as possible. In fact, most seasoned Rust developers internalize the borrow-checker and seldom actually think about it. For such developers, the borrow-checker is not a constraint: it only rejects programs because of typos, “minor oversights”, or (very rare) deep architectural errors from the developer. Meaning, the borrow-checker rejects memory-unsafe programs. (The same, to some extent, can be said about thread-unsafe programs.)

At the end of the day, Rust is a language with C/C++-like performance with very expressive, **zero-cost** abstraction mechanisms from functional programming languages; it also generates the memory allocation strategy of the program automatically if one exists, and, if none do, can point precisely to what the problem is. It it also worth noting that Rust has an extremely ergonomic and powerful project/package manager, [cargo](, and shines in the quality of the explanation and suggestions that come with its compiler errors. It is thus not surprising that Rust is so popular: it has been voted “most loved programming language” in the [StackOverflow developer survey]( for four years in a row, and has an impressive number of [companies running it in production]( for a young systems language.

<h2 class="page-subtitle">Layout</h2>

The session is divided in three parts:

1. A beginner introduction to Rust’s basics features (one day);
2. Crucial features and libraries for real-life development, along with a complex use-case used to showcase how to use them in a real project (two days);
3. Advanced/specific features (one day).

The road map below details the topics discussed in each part. Participants can chose to attend either the whole session, parts 1 through 3, parts 1 and 2, only part 2, or parts 2 and 3.

> Note that attendees planning to start at part 2 must make sure they are comfortable with the topics of part 1. This means, roughly, basic project management, having a basic understanding of ownership, and being able to write small programs that use some of the most common features of the standard library. Typically, this includes types Option, Result… and “simple” traits such as `Write`, `Read`, `Display`, `From`, `Into`...

<h2 class="page-subtitle">Road Map</h2>

1. **Day 1: Introduction**
    * basics: types and expressions, functions, using macros, user-defined types, loops, panic…
    * ecosystem: basic project management, dependencies, modules organization, rustfmt…
    * traits: simple polymorphism, defining and implementing traits…
    * ownership: copy/move semantics, references and basic lifetimes, slices…
2. **Days 2 and 3: Real-life Rust**
    * macros: defining declarative macros, handling visibility…
    * traits: rules, extensibility, associated types, advanced polymorphism constraints…
    * ownership and memory: lifetimes, boxing, Copy and Clone, higher-order traits…
    * ecosystem: meta-attributes, documentation, testing, anatomy of medium to big projects…
    * must-know standard and extended ( libraries: iterators and collections, error-handling, simple but fearless concurrency over iterators…
    * complex use-case: showcase virtually all topics discussed so far on a (relatively) complex
    project (roughly 2~3kloc)
3. **Day 4 : advanced features**
    * fearless concurrency: threads, the Send and Sync traits, mpsc, locks…
    * advanced traits: higher-kinded types, trait objects (dynamic dispatch), function pointers…
    * writing and using procedural macros
    * (relatively) shallow dive in unsafe Rust
    * complex use-case: showcase “fearless concurrency” and “advanced traits” topics on the complex use-case from days 2-3

> **NB:** while the different parts of the session are presented in chronological order, the topics inside each parts only loosely represent the actual order in which they will be discussed.

Part 3 discusses relatively specific topics, in particular unsafe Rust and procedural macros. This is where the training has the most flexibility and can be customized depending on the participants.
For instance, it is possible to replace the discussion on procedural macros and/or unsafe Rust by a deeper dive into fearless concurrency and/or an exercise session where attendees can practice the notions seen so far (typically from part 2) while the trainer provides hints, help and insights when needed.

<h2 class="page-subtitle">Open and Exclusive Sessions</h2>

So called “open sessions” are training sessions organized and hosted by OCamlPro in Paris, close to the Alésia metro station (line 4). These sessions are presented in French, although the slides are
in English. Open sessions do not provide any flexibility regarding part 3, except if **all** attendees agree on some modifications. For instance, trading the discussion on procedural macros for supervised exercises.

“Exclusive sessions” are training sessions given exclusively to a single company. These sessions can be hosted by OCamlPro or the company, although the latter depends on where the company is actually located. Compared to open ones, exclusive sessions let the company chose

   1. The language used during the session, between French and English (note that the slides themselves will be in English regardless), and
   2. Most aspects of part 3 (the last day).

<h2 class="page-subtitle">Workflow and Preparation</h2>

The whole session will rely heavily on examples. Attendees willing to follow along / experiment with the examples on their own machine during the session are encouraged to do so but should make sure they install Rust and setup a text editor or IDE appropriately.

Installing Rust is fairly easy on any mainstream operating system, see [rustup]( for more details. Do
note that installing Rust using a package manager is not recommended: Rust has a relatively fast release cycle that does not mix well with the inertia of most package managers. Ideally, one should always use the latest version, and attendees should make sure their Rust toolchain is up to date. Unless they do not plan to write code at all.

Mainstream text editors and IDEs have Rust syntax highlighting either built-in or available as a
plugin. Beware that code completion is currently a bit difficult to add to some text editors.
IntelliJ-based IDEs usually support code completion perfectly thanks to the [Rust IntelliJ plugin](

It is also worth noting that Rust has a very nice [online playground]( where one can write, build and run small programs. It constitutes a nice, hassle-free way to experiment with small examples without installing anything. Beware that attendees relying solely on the online playground will not be able to build, run or experiment with the complex use-case used in the session to showcase Rust features in the real world. This requires a local installation of the toolchain.

The trainer will use a terminal to run most commands and Sublime Text 3 (without code completion, but with error integration) to show and edit code during the session.

> **NB:** attendees to the open sessions will be provided free wifi, although we can give no guarantee in terms of bandwidth. Again, attendees should make sure to have their environment setup beforehand to avoid last minute issues impacting the session, bandwidth-related or otherwise.

<h2 class="page-subtile">Pricing</h2>

All costs given below are for open sessions. Pricing for exclusive sessions depends on the number of participants and the actual location, <a href="">contact us</a> for an estimation.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118

<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}
.tg .tg-7btt{border-color:inherit;font-weight:bold;text-align:center;vertical-align:top}
<table class="tg">
    <th class="tg-7btt">Full Session</th>
    <th class="tg-7btt">Beginner</th>
    <th class="tg-7btt">Intermediate</th>
    <th class="tg-7btt">Beginner and Intermediate</th>
    <th class="tg-7btt">Intermediate and advanced</th>
    <td class="tg-c3ow">3,500.00€</td>
    <td class="tg-c3ow">1,500.00€</td>
    <td class="tg-c3ow">2,000.00€</td>
    <td class="tg-c3ow">3,000.00€</td>
    <td class="tg-c3ow">3,000.00€</td>
    <td class="tg-c3ow">4 days</td>
    <td class="tg-c3ow">1 day</td>
    <td class="tg-c3ow">2 days</td>
    <td class="tg-c3ow">3 days</td>
    <td class="tg-c3ow">3 days</td>