liveBook · Manning

What you will learn in Refactoring to Rust

by Lily Mara, Joel Holmes

Chapter by chapter

Chapter 1: Why refactor to Rust

1.1 What is refactoring? · 1.2 What is Rust? · 1.3 Why Rust? · 1.4 Should you refactor to Rust? · 1.4.1 Performance · 1.4.2 Memory safety · 1.4.3 Maintainability · 1.5 When not to refactor to Rust · 1.6 How does it work? · 1.7 What will you learn in this book? · 1.7.1 Calling Rust functions directly from your program · 1.7.2 Communicating with a Rust service over the network · 1.8 Who is this book for? · 1.9 What tools do you need to get started? · 1.10 Summary

What you learn in chapter 1 →

Chapter 2: An overview of Rust

2.1 Ownership and borrowing · 2.2 Memory management in other languages · 2.3 Lifetimes · 2.3.1 References and borrowing · 2.3.2 Controlling mutability · 2.3.3 References and lifetimes · 2.4 Rust’s string types · 2.4.1 Mutable strings · 2.5 Enums and error handling · 2.5.1 Enums · 2.5.2 Error handling with enums · 2.5.3 The unit type · 2.5.4 Error types · 2.5.5 Transforming errors · 2.5.6 Panicking with errors · 2.6 Summary

What you learn in chapter 2 →

Chapter 3: Introduction to C FFI and unsafe Rust

3.1 Unsafe Rust · 3.1.1 Raw pointers · 3.2 C Foreign Function Interface · 3.2.1 Including a crate · 3.2.2 Creating a dynamic library with Rust · 3.2.3 Solving arithmetic expressions in Rust · 3.2.4 The Display trait · 3.3 Summary

What you learn in chapter 3 →

Chapter 4: Advanced FFI

4.1 Downloading the NGINX source code · 4.2 Creating the NGINX module · 4.3 Linking C to Rust · 4.3.1 Build scripts · 4.3.2 bindgen · 4.4 Reading the NGINX request · 4.4.1 Lifetime annotations · 4.4.2 Lifetime annotations in our NGINX plugin · 4.5 Using our calculator library · 4.6 Writing the HTTP response · 4.7 Summary

What you learn in chapter 4 →

Chapter 5: Structuring Rust libraries

5.1 Modules · 5.1.1 Who cares? · 5.1.2 Multiple files · 5.2 Paths · 5.2.1 Relative vs. absolute pathspaths · 5.2.2 Path aliases · 5.3 Upward visibility · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Integrating with dynamic languages

6.1 Data processing in Python · 6.2 Planning the move · 6.3 JSON Parsing · 6.4 Writing a Python extension module in Rust · 6.5 Benchmarking in Rust · 6.6 Optimized builds · 6.7 Summary

What you learn in chapter 6 →

Chapter 7: Testing your Rust integrations

7.1 Writing tests with Rust · 7.1.1 Documentation tests · 7.1.2 Adding tests to existing code · 7.2 Testing Rust code using Python · 7.2.1 Monkey patching · 7.3 Summary

What you learn in chapter 7 →

Chapter 8: Asynchronous Python with Rust

8.1 Generating a Mandelbrot set in Python · 8.2 Scaling · 8.3 Asyncio · 8.4 Threading · 8.5 Global Interpreter Lock · 8.6 PyO3 · 8.7 Summary

What you learn in chapter 8 →

Chapter 9: WebAssembly for refactoring JavaScript

9.1 What is WebAssembly? · 9.2 Moving from JavaScript to Rust · 9.3 Rust in the browser · 9.3.1 Requesting data · 9.3.2 Compiling to Wasm · 9.3.3 Loading Wasm in the browser · 9.4 Creating a React component · 9.5 Web components entirely in Rust · 9.6 Refactoring JavaScript revisited · 9.7 Summary

What you learn in chapter 9 →

Chapter 10: WebAssembly interface for refactoring

10.1 WASI universal runtime · 10.2 From the browser to the machine · 10.3 Wasm library · 10.4 Consuming Wasm · 10.5 More Wasm · 10.6 Wasm memory · 10.7 Just the beginning · 10.8 Summary

What you learn in chapter 10 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.