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.
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
, andevcxr_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.
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. |
|||
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. |
|||
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. |
|||
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. |
|||
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. |
|||
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. |
|||
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. |
|||
8 |
CLI Programs |
32 |
â–ª Building a command-line find and replace utility using Rust. â–ª Working with command-line arguments and parsing input. |
|||
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. |
|||
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. |
|||
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 |
|||
12 |
Network Programming |
37 |
â–ª Building networked applications with Rust. â–ª Working with TCP and UDP communication. â–ª Managing asynchronous network operations with async/await. |
|||
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. |
|||
14 |
Asynchronous Programming |
31 |
â–ª Learning asynchronous programming with async/await in Rust. â–ª Utilizing the Tokio library for building asynchronous applications. |
|||
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. |
We welcome contributions to enhance this repository! To contribute, please follow the CONTRIBUTING.adoc
file guidelines. Thank you for helping make this project better!
This project is licensed under the MIT license. For more details, You can refer to the licence
file.