Rust Training Camp

Friends who follow me may know that I previously launched a column titled “Rust Programming First Lesson” on Geek Time. The goal of this column is to help you deeply understand the Rust language system, master the essence of Rust development, and appreciate the charm of Rust’s design philosophy. For example, I will explain how memory changes in the scenario of inserting and deleting data in a HashMap; and use the lifecycle of values on the heap and stack to illustrate the meaning and design considerations of lifetimes in Rust.

Now, to help more students master Rust and truly apply it in production practices, I have opened the “Rust Training Camp” on Geek Time. Unlike the column, the content of the training camp focuses more on practice. We will learn how to use Rust better through different programming projects, maintaining code quality close to production environments. We will not delve deeply into the kernel level of the language; instead, we hope to help everyone broaden their horizons and gradually master the Rust skill tree, enabling them to flexibly apply Rust in various scenarios.

In the training camp, we will start with the basic syntax of Rust and progress to complete system architecture practices. The course content includes syntax, data structures, Rust ecosystem tools, cross-platform applications, and architectural design, helping you smoothly transition from other languages to Rust.

To prepare for this course, I spent the past two weekends sitting at my computer from 7 a.m. to 11 p.m., recording videos whenever I did not need to accompany my child to extracurricular classes.

The first week’s content covers basic syntax, data types, and the concepts and usage of generics and traits. I used 14 lectures and over ten hours of material to introduce: starting from a command line tool that converts CSV to JSON/YAML, gradually expanding it into a toolkit that provides various functionalities. While introducing data structures, generics, and traits, I also discussed foundational knowledge such as hashing (blake3), encryption (chacha20poly1305), signing (ed25519), and base64, culminating in an HTTP static file server as the final project:

Rust Training Camp

The second week’s content involves concurrency and asynchrony, which are challenging topics. I used 11 lectures, over ten hours of material, and more than two thousand lines of code to help everyone tackle concurrency fearlessly, from beginner to proficient (but there is no need to be overly concerned about the course load: the material for the first and second weeks is not the norm, and as everyone becomes more familiar with Rust, the subsequent content will gradually return to a normal range). I started conceptually, introducing the basic ideas of multi-threaded development in Rust:

Rust Training Camp

Then, using a matrix multiplication example, I taught how to decouple and refactor a single-threaded, highly coupled process so that it can potentially be processed in multiple threads, and then use scheduling and inter-process communication to perform map/reduce on “CPU-intensive” tasks:

Rust Training Camp

For asynchrony, I will introduce the basic principles of Tokio, the mainstream asynchronous runtime in Rust:

Rust Training Camp

After some simple warm-up projects, we will build a simple yet sophisticated Redis server together:

Rust Training Camp

I will start with the RESP protocol, first teaching how to manually parse the RESP protocol (in future classes during the “Otherworldly Gate” week, we will use parsec/PEG to parse the RESP protocol more intelligently), then use traits to unify the parsing behavior, and finally parse the commands sent by the client based on the parsed RespFrame, ultimately building the network layer. This code is constructed entirely according to production environment development ideas, layer by layer, and there are as many as 33 unit tests covering all core functionalities. The final product can communicate normally with the official redis-cli, supporting commands like set/get/hset/hget/hgetall.

With the foundation laid in the first two weeks, the content of the third week is relatively easier. I will start with declarative macros, then address some repetitive code from the second week’s course using procedural macros. Initially, we will use the basic functionalities provided by syn/quote to parse the syntax tree, exploring the syntax tree to gather the information we need and organize it into code output; then we will introduce the darling crate, seeing how darling helps us automatically find the content we want from the syntax tree and organize it into various data structures. We will learn various details and techniques for building procedural macros, handling generic parameters, and attributes of procedural macro fields, etc. We will construct various useful macros to avoid repetitive calls in the code (such as AutoDeref, EnumFrom, etc.).

Rust Training Camp

Currently, I have completed more than half of the content for the third week, but to have enough redundancy to cope with unexpected work or business trips, I have been rushing to keep pace every weekend. I will continue to work hard to cover more content and explain more. My principle is: when creating a course, I must be worthy of the students taking it.

As I mentioned in previous live broadcasts, I will adopt an iterative learning approach for this course: in the first two weeks, a large amount of content will come at you, and you will immediately encounter 90% of the concepts and methods you will encounter in Rust development. However, this content will continuously reinforce itself in deeper iterations in a spiral manner. Just like Goku training with Gohan in the time chamber to face Cell’s challenge, the first important content of the training is to maintain the Super Saiyan state, making it a norm, and then strengthening the training based on that.

Rust Training Camp

This is a remarkable realization, just like when we are learning to speak, we first normalize speaking before learning grammar and tenses in school. I believe that learning a language should have such an attitude and method.

Rust Training Camp

At the same time, language is just a tool; strong expressive ability comes from our understanding of a broader world. Just like everyone can speak Chinese but has vastly different expressive abilities. While continuously building practical projects, we also need to learn more tools, master more ideas, and become proficient in various practical skills, so that we can truly improve:

Rust Training Camp

Nowadays, Rust is increasingly becoming a hot topic in software development. Recently, the White House surprisingly released a white paper recommending that future software consider memory safety, almost naming Rust as the language to use. As more and more infrastructure is rewritten in Rust (Pingora, please put my name on the screen), I believe that in the future, Rust will be as ubiquitous as water, benefiting all things.

If you want to keep up with the technological trend and master Rust, I recommend you join the training camp. I also hope you can think about your learning goals. I will share my methods and thoughts on learning programming languages in the course. After you complete the entire course, I hope you will not only have learned Rust’s programming syntax and ecosystem tools but, more importantly, be able to break free from language constraints, master software design methodologies, and truly become an excellent software development engineer, continuously improving yourself throughout your long career.

I look forward to your joining. For course details and purchase discounts, please scan the QR code below.

Rust Training Camp

Leave a Comment