We may earn an affiliate commission when you visit our partners.
Packt Publishing

Scripting languages will provide safety, but not concurrency and speed, while traditional systems programming languages such as C and C++ will definitely give you speed and some concurrency, but forget about safety. If you need safety, concurrency, and speed, then Rust is the only viable option.

Read more

Scripting languages will provide safety, but not concurrency and speed, while traditional systems programming languages such as C and C++ will definitely give you speed and some concurrency, but forget about safety. If you need safety, concurrency, and speed, then Rust is the only viable option.

In this course, you will learn how Rust guarantees memory and thread safety at compile-time, yet uses zero-cost abstractions without the runtime overhead of a garbage collector. You'll learn how to monitor the flow of data through a pipeline by building your own middleware utility. You'll learn how to utilize I/O to interact with the command line, work with standard library mpsc channels to perform data flows, and create an ergonomic timer for your project. You'll apply key concepts in every section while creating your own middleware tool in Rust along the way.

By the end of this practical course, you will feel comfortable designing safe, consistent, parallel, and high-performance applications in Rust using systems programming.

This course should appeal to intermediate Linux and general Unix programmers, network programmers, and C/C++ programmers interested in learning different approaches to concurrency. Prior knowledge of basic programming concepts is required, and a working knowledge of Rust is assumed.

About the Author

Nathan Stocks has spent the last 20 years working in software development, mostly in the field of backend infrastructure. He fell in love with Rust in 2016 and began teaching it in 2017. For the past several years, he has focused on systems-level programming. He maintained the AVbin audio library (written in C) from 2011-2013. He has had tons of fun learning, using, and teaching Rust at conferences and online. He also loves Python and PostgreSQL, and still occasionally suffers from nightmares about C and C++.

He currently works at GitHub, managing the Git Storage team, and spends his nights in pursuit of someday creating a successful indie game in Rust.

Enroll now

Here's a deal for you

We found an offer that may be relevant to this course.
Save money when you learn. All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • Explore rust's package registry for discovering and sharing code
  • Use multithreading to unlock the power of multiple cores
  • Get to know data-flow rate and speed through a pipeline
  • Display time-based statistics using stderr
  • Build your own middleware project to control the flow of data between two processes
  • Best practices and techniques to set up your project for success
  • Test and publish your own project on crates .io

Syllabus

Preparing for Systems Programming with Rust

This video provides an overview of the entire course.

Here, see the overview of what Rust is, where it came from, and why we might want to use it.

   •  Describe what Rust is

   •  Explain how Rust came to be

   •  Explain the benefits of Rust

Read more

Rust is a difficult language to learn and use. Rust support in your IDE/Editor helps a lot.

   •  Show the website that lists major IDEs/Editors and how to configure them

   •  Show how to find Rust support for IDEs/Editors not on the list

   •  Demonstrate the benefits of Rust IDE support in IntelliJ

We need a tool to create, manage, build, run, document, and test our code.

   •  Overview cargo’s capabilities

   •  Demonstrate creating a binary application

   •  Demonstrate creating a library

The student does not know what we are going to build for this course, so let’s show them.

   •  Describe the problem of processing data without progress indicators

   •  Show processing data with and without our project

   •  Describe the capabilities of our project

We have no project to work in, yet.

   •  Select a name and location for the project

   •  Create the project with cargo and configure it

   •  Select a version control system and configure it

We need to read data from somewhere, process it, and write it back out somewhere else.

   •  Read data from stdin

   •  Process the data

   •  Write data to stdout

We need an ergonomic way to print extra debugging information during development.

   •  Identify a candidate debugging expression

   •  Wrap the expression in dbg!()

   •  Analyze the debugging output

Code is harder to read and distracting conflicts often occur when code is not styled consistently and using the same idioms.

   •  Call out problems of not adhering to standards and idioms

   •  Demonstrate cargo fmt and cargo clippy

   •  Demonstrate automating the tools

Ignoring and not handling errors leads to unsafe and buggy code.

   •  Describe situations which occur when errors are not handled properly

   •  Demonstrate handling errors by choosing to crash

   •  Demonstrate handling errors more gracefully

We need a way to parse command-line arguments to affect the behavior of our program.

   •  Describe the need to handle command-line arguments

   •  Demonstrate how to use the clap library in code

   •  Demonstrate the command-line handling in the compiled project

We need to be able to read and write files, it needs to be fast, and we would like it to be convenient.

   •  Demonstrate reading and writing files

   •  Demonstrate buffered reading and writing files for better performance

   •  Demonstrate using Read/Write traits to make code convenient

As projects grow larger keeping all the code in one file causes it to be hard to understand, use, and re-use. Organizing code into libraries is the answer.

   •  Describe the problem of having all code in one file

   •  Explain how libraries work in Rust

   •  Organize code into a library and use it from our binary

Our main thread can only do one thing at a time: it can read, it can process, or it can output. We would like to be able to do all three simultaneously.

   •  Describe the limitation of one thread

   •  Explain how to create child threads

   •  Execute our read, processing, and write code in separate threads

We need to communicate between our threads, preferably in a way that avoids locking. MPSC channels are a good tool for that.

   •  Describe our need to communicate between threads

   •  Explain how MPSC channels work

   •  Use MPSC channels to communicate between our threads

Using MPSC channels has it’s pros and cons. Use crossbeam channels to take advantage of different tradeoffs.

   •  Describe the drawbacks of using MPSC channels

   •  Explain how crossbeam channels overcome those drawbacks

   •  Refactor our project to use crossbeam channels

Working with time requires understanding the primitive Instant time type.

   •  Explain how to measure time, as we need points in time

   •  Explain how Instant works

   •  Use Instant in our program

Once we have Instants, we can calculate durations between Instants for use in calculations.

   •  Explain how to use Instants to get durations

   •  Calculate durations in our project

   •  Use the durations for progress output

Mixing time-keeping code with other logic can get confusing. Encapsulating all the time-keeping into a struct helps keep code understandable.

   •  Explain how mixing time-keeping code with logic gets messy

   •  Describe a strategy to encapsulate the code in a struct

   •  Refactor the time-keeping code into a struct

We are printing progress at a rate far higher than a human can perceive, which wastes resources unnecessarily. We can use our timer struct to only output progress periodically.

   •  Describe how updating progress after every read is wasteful

   •  Refactor our code to output progress only periodically

   •  Demonstrate the change in the working project

Colored output is often more engaging and more readable. We can use a library to easily colorize our output.

   •  Describe the benefits of colorizing our output

   •  Explain how to use the crossterm library

   •  Refactor our code to colorize output with crossterm

Well-organized libraries are crucial for being able to build larger projects. To make a well-organized library, one must understand how to build libraries.

   •  Explain the importance of maintaining well-organized libraries

   •  Explain library organization in much more detail than earlier

   •  Show an example of using more advanced techniques

Automated tests are vital to both, helping ensure your code runs correctly in the first place, and ensuring that future changes do not break the expected behavior.

   •  Explain why testing is important

   •  Show how to write tests

   •  Demonstrate running tests and interpreting the output

Undocumented code is difficult to figure out, even for the person who originally wrote it. Documenting the design, intentions, and behavior of your code will enable better use of it.

   •  Explain the problem of undocumented code

   •  Demonstrate different techniques for documenting code

   •  Demonstrate generation of the documentation web pages

Version numbers are an important way to communicate how your project changes over time. Semantic versioning is the scheme that Rust uses.

   •  Explain the importance of adhering to a versioning scheme

   •  Explain how semantic versioning works and what it means

   •  Demonstrate changing version numbers on a project

In order to participate in the larger Rust ecosystem, you must be able to publish your code in a way that others can consume it. Cargo facilitates publishing your project to crates.io.

   •  Describe how your project can be published for others to use

   •  Explain publishing settings that need to be set

   •  Demonstrate publishing the project for this course to crates.io

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses Rust, which offers memory and thread safety at compile-time and zero-cost abstractions without the runtime overhead of a garbage collector, making it suitable for systems programming
Explores Rust's package registry, which facilitates discovering and sharing code, enabling learners to participate in the Rust ecosystem and leverage community resources
Requires a working knowledge of Rust, so learners without prior experience may need to acquire foundational knowledge before taking this course
Applies multithreading to unlock the power of multiple cores, which is essential for building high-performance and concurrent applications in systems programming
Covers best practices and techniques to set up projects for success, which helps learners establish a solid foundation for building robust and maintainable systems in Rust
Involves building a middleware project to control the flow of data between two processes, providing hands-on experience in applying systems programming concepts

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Practical rust systems programming project

According to learners, this course offers a practical, hands-on approach to systems programming with Rust by having students build a real-world middleware utility. Many found the deep dives into multithreading, channels, and I/O particularly valuable, appreciating the clear explanations of complex concurrency concepts. The focus on best practices like testing, documentation, and publishing to crates.io is frequently highlighted as a positive takeaway. While the project-based structure is a major strength, some students noted that the course assumes a stronger foundation in Rust than just 'working knowledge', making it potentially challenging for beginners or those transitioning from languages other than C/C++. Overall, the reviews indicate a largely positive experience for learners with the appropriate prerequisites.
Good practical examples for core topics.
"The way error handling was integrated throughout the project helped me understand Rust's approach much better."
"Handling file I/O and command-line arguments using libraries like `clap` was very practical and applicable to real tools."
"Using `dbg!()` and other debugging techniques shown were simple but effective tips I immediately used."
"The explanations on reading/writing data and handling potential errors were clear."
Covers important development practices.
"Appreciated the sections on testing, documentation, and publishing to crates.io - vital for anyone wanting to build and share Rust projects."
"Learning about cargo features like fmt and clippy, along with testing, provided a great foundation for professional development."
"The emphasis on best practices felt very valuable and went beyond just language syntax."
"Practical tips on project setup, versioning, and community engagement were very helpful."
Excellent coverage of multithreading and channels.
"The section on multithreading and MPSC/crossbeam channels was particularly enlightening and explained complex topics clearly."
"Understanding data flow pipelines and using channels was a key takeaway, very well explained and applied in the project."
"Learning how Rust handles concurrency safely through channels felt very practical and immediately applicable."
"The material on threads and communication between them using channels was thorough and easy to grasp."
Project-based learning is highly effective.
"Building the middleware project from scratch was incredibly helpful for solidifying concepts. This hands-on approach is the best part."
"I really enjoyed the practical application of Rust features by working on a single, evolving project throughout the course."
"The guided project gave me a clear goal and helped me see how different Rust features fit together in a real-world application."
"The hands-on coding and projects are the strongest part of the course for me, it's not just theory."
Requires solid Rust and systems programming background.
"This course definitely requires more than just 'working knowledge' of Rust. Be prepared for a steep learning curve if you're not already comfortable."
"As a C++ developer, I found the pace and assumptions about systems programming knowledge to be just right, but I can see how others might struggle."
"I had some Rust experience, but the leap into systems-level concepts and specific libraries felt challenging at times."
"This is not a beginner's course for Rust or systems programming. Make sure you meet the prerequisites or be ready to work hard."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Hands-On Systems Programming with Rust with these activities:
Review Basic Concurrency Concepts
Reinforce your understanding of concurrency concepts to better grasp Rust's approach to multithreading.
Browse courses on Concurrency
Show steps
  • Read about threads, processes, and synchronization primitives.
  • Review common concurrency issues like race conditions and deadlocks.
Read 'Rust in Action'
Deepen your understanding of Rust's systems programming capabilities with a comprehensive guide.
Show steps
  • Read the chapters related to concurrency and memory management.
  • Try the code examples and exercises in the book.
Build a Simple File Processing Tool
Practice file I/O and error handling in Rust by creating a tool that reads, processes, and writes data to files.
Show steps
  • Design the tool's functionality and command-line interface.
  • Implement file reading, processing, and writing using Rust's standard library.
  • Add error handling to gracefully handle file not found or permission errors.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Implement Common Data Structures in Rust
Solidify your understanding of Rust's ownership and borrowing system by implementing data structures from scratch.
Browse courses on Data Structures
Show steps
  • Implement a vector with dynamic resizing.
  • Implement a hash map with collision handling.
  • Implement a linked list with safe memory management.
Write a Blog Post on Rust Concurrency
Reinforce your understanding of Rust's concurrency features by explaining them in a blog post.
Browse courses on Concurrency
Show steps
  • Research different approaches to concurrency in Rust.
  • Write a clear and concise explanation of threads, channels, and mutexes.
  • Provide code examples to illustrate the concepts.
Contribute to a Rust Project
Deepen your understanding of Rust by contributing to an open-source project.
Browse courses on Open Source
Show steps
  • Find a Rust project on GitHub that interests you.
  • Identify a bug or feature request to work on.
  • Submit a pull request with your changes.
Read 'Programming Rust'
Expand your knowledge of Rust with a comprehensive guide covering advanced topics.
Show steps
  • Read the chapters on advanced data structures and concurrency.
  • Experiment with the code examples and try to modify them.

Career center

Learners who complete Hands-On Systems Programming with Rust will develop knowledge and skills that may be useful to these careers:
Systems Software Engineer
A systems software engineer designs, develops, and maintains the core software that operates computer systems. This role requires a deep understanding of systems programming concepts, including memory management, concurrency, and low-level I/O. This course, with its hands-on approach to systems programming in Rust, fits perfectly into the role. One benefit of the course is that it teaches how to use multithreading to unlock the power of multiple cores and how to build a middleware utility. By the end of this practical course, you will feel more confident in how to design safe, consistent, parallel, and high-performance applications using Rust systems programming. A systems software engineer should certainly take this course to develop the skills they need to excel.
embedded systems developer
Embedded systems developers write software for devices that are not general-purpose computers, such as appliances, industrial control systems, and medical devices. This type of work demands efficiency and safety. This course will be useful for developing skills to create software that meets those requirements. The course emphasizes how Rust ensures memory and thread safety at compile-time, and how to use zero-cost abstractions efficiently. Moreover, the course provides experience with I/O, a necessary skill for an embedded systems developer. An embedded systems developer who wants to learn how to use Rust for embedded applications should definitely take this course.
Operating Systems Developer
Operating systems developers work on the fundamental software that manages a computer's hardware and software resources. This job requires an expertise in areas such as memory management, concurrency, and low level communication, as covered in this course. A major part of the course is the hands-on experience with the Rust language. A person interested in this role should pay attention to how the course teaches memory and thread safety, as well as how to construct a practical, real-world middleware tool. Aspiring operating systems developers should take this course to gain critical development skills.
High-Performance Computing Engineer
A high performance computing engineer develops software to handle large amounts of data and complex computations. The course would be relevant to this role. It emphasizes concurrency and speed, as well as the creation of efficient data processing pipelines. The course focuses on systems programming in Rust, and uses zero-cost abstractions. This hands-on approach would help a high performance computing engineer develop the skills they need. The skills covered would be very useful for someone looking to succeed in this role.
Backend Engineer
A backend engineer builds the server-side logic that powers web applications and other software. This often involves handling concurrency, data processing, and I/O operations, all of which are covered in this course. This course teaches many relevant concepts needed to work as a backend engineer. For example, you'll learn how to monitor the flow of data through a pipeline and build your own middleware utility. The course also covers how to effectively use multithreading to improve performance. A backend engineer who handles a lot of concurrent requests or high-throughput data will find this course highly valuable.
Game Developer
Game developers write the software that makes video games, and often need to work with high performance systems, complex data processing pipelines, and multithreading. A game developer could find this course essential. You'll learn about working with I/O, utilizing multithreading for performance, and managing data flow through a pipeline. This course would be very beneficial for game developers that want to write high performance games with Rust. The ability to create safe, consistent, and high-performance applications is a must for game development.
Middleware Developer
Middleware developers create software that connects different components of an application or system. This course directly trains you to build your own middleware utility, and teaches you how to monitor data flow through a pipeline. You'll learn how to utilize multithreading to unlock the power of multiple cores, and how to create an ergonomic timer for your project. This course may be useful for middleware developers who want to use Rust for creating high-performance, safe, and concurrent systems. A developer in this role would learn a great deal from this course.
Network Programmer
Network programmers work on building the software that enables communication between computers, often involving writing code for network protocols. This course includes hands-on work, which can be useful for demonstrating such skills. Notably, this course explores how to work with I/O, a vital part of network programming. It also shows how to use multithreading to handle concurrent network connections. This course may be useful for network programmers who want to learn how to use Rust for safe and efficient network applications.
DevOps Engineer
DevOps engineers focus on automating and streamlining software development and deployment processes. They work with pipelines, concurrency, and performance tuning, all of which are covered in this course. The experience a user gains from building their own middleware tool is very useful in this role. This course may be useful for an engineer working in DevOps by providing critical knowledge about writing concurrent programs using systems-level programming. A DevOps engineer taking this course can expect to learn strategies to automate tasks and improve build processes.
Database Engineer
Database engineers design and implement databases, and must pay attention to performance and data handling. This course provides background information that can be helpful in this career. For instance, the course covers how to manage data flow, implement multithreading, and optimize performance. A database engineer may find this course useful if they are considering the use of Rust in implementing databases or database tools. Consider taking this course if you'd like the experience of developing safe, high-performance applications using Rust.
Cloud Engineer
Cloud engineers design, build, and maintain cloud infrastructure. Cloud systems are often reliant on concurrent processes, and this course provides a great deal of instruction in that area. This course also teaches the basics of I/O and time management. The knowledge gained from the hands-on project in the course, where you build a middleware utility, can be transferrable to this role. The course may be useful for cloud engineers who want to learn how to leverage Rust for cloud applications. A cloud engineer seeking to broaden their skill set should consider this course.
Financial Software Developer
Financial software developers create systems for trading platforms, risk management, and other applications in finance. Such systems demand high performance, safety, and concurrency, all major themes in this course. You'll learn how to write concurrent programs with Rust, utilize multithreading, and manage data flow. The practical experience of building a middleware tool is also highly relevant. This course may be useful for financial software developers looking to adopt Rust in their projects. Financial developers who want to apply robust methods to building high-performance applications can benefit from this course.
Security Engineer
Security engineers focus on protecting computer systems and networks from threats. This course demonstrates how Rust ensures memory safety and prevents many common coding vulnerabilities. It also covers how to manage data flow and concurrency safely, which is relevant for this role. The concepts covered in this course are valuable for writing secure code. A security engineer who wants to develop safe and reliable software with Rust, may find this course helpful. It will be particularly useful for those working on security-critical systems.
Robotics Software Engineer
Robotics software engineers develop software for robots, often working with real-time processing, concurrency, and hardware interfaces. In this course you will learn key concepts for these sorts of tasks. For example, you'll learn how to use multithreading, manage data flow, and work with I/O, which are all important in this field. This course may be useful if you're a robotics software engineer interested in Rust. The course's focus on building a middleware tool is a valuable experience in this line of work.
Software Architect
A software architect designs the high-level structure and organization of software systems. It's a job that requires a deep understanding of systems programming principles. This course is practical and hands-on. You'll learn how to create middleware, handle I/O, and manage concurrency using multithreading. Software architects are tasked with designing efficient and reliable systems. Taking this course will give an architect the skills required to design high-performance applications. This course may be useful in helping a software architect to advance their career.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Hands-On Systems Programming with Rust.
Provides a practical, hands-on approach to learning Rust, focusing on systems programming concepts. It covers topics like memory management, concurrency, and low-level I/O, which are essential for this course. 'Rust in Action' valuable resource for understanding the 'why' behind Rust's design choices and how to apply them in real-world scenarios. It serves as a useful reference throughout the course and beyond.
Offers a comprehensive guide to Rust, covering everything from basic syntax to advanced topics like concurrency and unsafe code. It's particularly useful for understanding the underlying principles of Rust's memory safety and ownership model. 'Programming Rust' great resource for solidifying your understanding of the language and its best practices. It is commonly used as a textbook in academic settings.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser