Skip to content

OrangeAVA/Ultimate-Rust-for-Systems-Programming

Repository files navigation

Ultimate Rust for Systems Programming

Work In Progress

Made with Rust

Made with LaTeX

Jupyter Notebook

Share On Reddit

Share On Ycombinator

Share On Twitter

Share On Facebook

Welcome

This collection of Jupyter notebooks provides an in-depth journey into the realm of system programming with Rust. Empowered by a Rust kernel at its core, you have the opportunity to delve deeply into the complexities of system programming, capitalizing on the full potential of the Rust programming language. Augmented by a diverse range of Rust libraries, including serde, serde-json, anyhow, thiserror, reqwest, tokio, warp, rust-csv, clap, rust-ctrlc, proptest, crossbeam, async-std, regex, chrono, rppal, rust-i2cdev, fs2-rsv, memmap-rs, hyper, rand, num, tempfile, rstest, mockall, tokio-tungstenite, futures-rs, rusqlite, opencv-rust , you can seamlessly work with systems at a lower level using Rust. Whether you’re an experienced developer or just kicking off your programming journey, these notebooks offer a robust and invaluable resource for mastering system programming in Rust.

Installation

To use the notebooks in this repository, you need to set up your environment. Follow these steps to get started:

  • Clone the repository to your local machine:

git clone https://github.com/wiseaidev/rust-lang-book.git
  • Install the required dependencies and libraries. Make sure you have Rust, Jupyter Notebook, and evcxr_jupyter installed on your system.

# Install a Rust toolchain (e.g. nightly):
[quote]
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly

# Install Jupyter Notebook:
[quote]
pip install notebook

# Install evcxr_jupyter:
[quote]
cargo install evcxr_jupyter
evcxr_jupyter --install
  • Navigate to the cloned repository:

cd rust-lang-book
  • Start Jupyter Notebook:

jupyter notebook
  • Access the notebooks in your web browser by clicking on the notebook file you want to explore.

Chapters

ID Chapter NB Pages Topics Open on GitHub Launch on Binder Launch on Colab

1

Introduction to Rust and Setup

44

▪ What is Rust and its significance in system programming?

▪ Advantages of Rust over C/C++ for system development.

▪ Exploring Rust’s distinctive features and benefits.

▪ Installing Rust on Windows, Linux, and MacOS.

▪ Setting up the development environment, including IDEs and tools.

▪ Writing the first Rust program: "Hello, World!"

▪ Understanding and utilizing Cargo, Rust’s package manager.

GitHub

Launch on Binder

Open on Colab

2

Basics of Rust

38

▪ Introduction to variables and data types in Rust.

▪ Control flow using if, else, loops, and match.

▪ Defining functions and working with closures.

▪ Understanding ownership, borrowing, and lifetimes in Rust.

▪ Highlighting Rust’s memory safety features.

▪ Writing memory-safe code with the help of the borrow checker.

GitHub

Launch on Binder

Open on Colab

3

Advanced Concepts - Traits and Generics

32

▪ Understanding the concept of traits and their role in code reuse.

▪ Implementing traits for user-defined data structures.

▪ Working with generic functions and data structures in Rust.

▪ Exploring trait bounds and associated types for increased generality.

GitHub

Launch on Binder

Open on Colab

4

Rust Built-In Data Structures

74

▪ Working with Rust’s array-like data structures: Vectors, Arrays, Tuples, and Slices.

▪ Introduction to Rust’s hash-based collections: HashMap and HashSet.

▪ Demonstrating common operations and manipulations with Rust collections and more.

GitHub

Launch on Binder

Open on Colab

5

Error Handling and Recovery

35

▪ Dealing with errors using Result and Option in Rust.

▪ Techniques for error propagation and handling multiple errors.

▪ Creating custom error types to enhance error messages.

GitHub

Launch on Binder

Open on Colab

6

Memory Management and Pointers

43

▪ Understanding stack and heap memory allocation in Rust.

▪ Introducing smart pointers: Box, Rc, and Arc.

▪ An introduction to unsafe Rust and handling raw pointers.

GitHub

Launch on Binder

Open on Colab

7

Managing Concurrency

42

▪ Understanding concurrent programming with threads and synchronization.

▪ Introducing concurrent data structures: Mutex and RwLock.

▪ Techniques for thread communication and message passing in Rust.

GitHub

Launch on Binder

Open on Colab

8

CLI Programs

32

▪ Building a command-line find and replace utility using Rust.

▪ Working with command-line arguments and parsing input.

GitHub

Launch on Binder

Open on Colab

9

Working with Devices I/O

52

▪ Reading from and writing to files in Rust.

▪ Performing common filesystem operations.

▪ Overview of working with hardware devices through Rust interfaces.

GitHub

Launch on Binder

Open on Colab

10

Iterators and Closures

50

▪ Working with iterators for efficient data processing in Rust.

▪ Writing closures and capturing variables in Rust.

▪ Applying iterators and closures to practical examples.

GitHub

Launch on Binder

Open on Colab

11

Unit Testing in Rust

32

▪ Writing test functions and test modules in Rust.

▪ Executing tests and understanding test results.

▪ Practicing Test-driven development (TDD) in Rust

GitHub

Launch on Binder

Open on Colab

12

Network Programming

37

▪ Building networked applications with Rust.

▪ Working with TCP and UDP communication.

▪ Managing asynchronous network operations with async/await.

GitHub

Launch on Binder

Open on Colab

13

Unsafe Code

35

▪ What is unsafe code in Rust and when is it necessary?

▪ Scenarios where developers might opt for unsafe blocks.

▪ Balancing performance and safety considerations.

▪ Real-world examples showcasing the need for unsafe code.

▪ Best practices for using unsafe code.

▪ Memory safety violations in unsafe code.

▪ Real-World Examples Showcasing the Need for Unsafe Code.

▪ Case studies highlighting real-world consequences.

▪ Risks associated with common unsafe coding practices.

GitHub

Launch on Binder

Open on Colab

14

Asynchronous Programming

31

▪ Learning asynchronous programming with async/await in Rust.

▪ Utilizing the Tokio library for building asynchronous applications.

GitHub

Launch on Binder

Open on Colab

15

Web Assembly

30

▪ Introduction to WebAssembly and its benefits.

▪ Configuring Rust for WebAssembly development.

▪ Integrating Rust code with JavaScript using WebAssembly.

▪ Real-world Applications of Rust and WebAssembly.

Netlify Netlify

Netlify

Netlify

Contributing

We welcome contributions to enhance this repository! To contribute, please follow the CONTRIBUTING.adoc file guidelines. Thank you for helping make this project better!

License

This project is licensed under the MIT license. For more details, You can refer to the licence file.

Star History

Star History Chart

About

Ultimate Rust for Systems Programming, published by Orange, AVA™

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published