Skip to content

wiseaidev/rust-lang-book

 
 

Repository files navigation

Mastering Rust for System Programming

Work In Progress

Made with Rust

Made with LaTeX

Jupyter Notebook

Share On Reddit

Share On Ycombinator

Share On Twitter

Share On Facebook

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

Ultimate Rust for Systems Programming: Master Core Programming for Architecting Secure and Reliable Software Systems with Rust and WebAssembly

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

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