The Rust Programming Language
All labs will be done in Rust. Beside the intrinsic quality of the language, there are a few reasons for this choice in the context of this course:
- performance: we are going to work on some CPU-intensive algorithms, and Rust will let you have excellent performance without having to think about it.
- reliability: the Rust compiler can often feel annoyingly strict, but it will save you from many bugs that would be hard to catch otherwise.
- cross-platform: Rust tends to very reliably work on most platforms.
In the context of this course, it means that you can focus on the AI algorithms and problems we are going to study.
Of course, the downside is that you will have to build some basic skills in Rust. We will only require the fundamentals, and provide a lot of help and examples.
Getting Acquainted with Rust
The recommended way to get started with Rust is to follow the official book.
Ideally, before the first lab, you should have read the following chapters:
- Install & Hello World
- Quick Tour of a Rust program
- walks you through a simple program, explaining the basic syntax and concepts.
- Common programming concepts (variables, functions, control flow; ...)
- you will learn about the basic building blocks of Rust programs, that you already know from other languages but may have different syntax
- Understanding Ownership
- Ownership is Rust’s most unique feature, and I highly recommend carefully reading this chapter.
- Note that the concept of ownership is not unique to Rust, but the Rust compiler checks that you respect it, which is unique. In C/C++, you typically would have to follow the same rules, but if you fail to apply them, the compiler won't help you (and your program may crash 10 minutes later)
Chapters 5 to 9 cover some aspects that would be useful but can for the most part be picked up as we go.
Chapters 10 and more are about intermediate topics which we will try to avoid in the labs.
Additional Resources
- Editors:
- Visual Studio Code with the Rust analyzer extension
- RustRover (for Jetbrains afficionados)
- Any editor with a rust-analyzer plugin (zed, neovim, ...)
- Rustlings a series of small exercises to get started witht the language
- Rust Playground: to quickly test some code without having to install anything
- Comprehensive Rust: a quite elaborated course built for in-class teaching but can be used for self-learning looking at the speaker-notes