Refactoring to Rust Edition: 1

by Mara, Lily ; Holmes, Joel

Programming

Book Details

Book Title

Refactoring to Rust Edition: 1

Author

Mara, Lily ; Holmes, Joel

Publisher

Manning Publications City: Shelter Island, NY

Publication Date

2025

ISBN

9781617299018

Number of Pages

304

Language

English

Format

PDF

File Size

3.1MB

Subject

Rust

Table of Contents

  • Cover
  • Copyright
  • Contributors
  • Table of Contents
  • Preface
  • Acknowledgments
  • About this book
  • About the authors
  • About the cover illustration
  • Chapter 1: Why refactor to Rust
  • What is refactoring?
  • What is Rust?
  • Why Rust?
  • Should you refactor to Rust?
  • When not to refactor to Rust
  • How does it work?
  • What will you learn in this book?
  • Who is this book for?
  • What tools do you need to get started?
  • Summary
  • Chapter 2: An overview of Rust
  • Ownership and borrowing
  • Memory management in other languages
  • Lifetimes
  • Rust’s string types
  • Enums and error handling
  • Summary
  • Chapter 3: Introduction to C FFI and unsafe Rust
  • Unsafe Rust
  • C Foreign Function Interface
  • Summary
  • Chapter 4: Advanced FFI
  • Downloading the NGINX source code
  • Creating the NGINX module
  • Linking C to Rust
  • Reading the NGINX request
  • Using our calculator library
  • Writing the HTTP response
  • Summary
  • Chapter 5: Structuring Rust libraries
  • Modules
  • Paths
  • Upward visibility
  • Summary
  • Chapter 6: Integrating with dynamic languages
  • Data processing in Python
  • Planning the move
  • JSON Parsing
  • Writing a Python extension module in Rust
  • Benchmarking in Rust
  • Optimized builds
  • Summary
  • Chapter 7: Testing your Rust integrations
  • Writing tests with Rust
  • Testing Rust code using Python
  • Summary
  • Chapter 8: Asynchronous Python with Rust
  • Generating a Mandelbrot set in Python
  • Scaling
  • Asyncio
  • Threading
  • Global Interpreter Lock
  • PyO3
  • Summary
  • Chapter 9: WebAssembly for refactoring JavaScript
  • What is WebAssembly?
  • Moving from JavaScript to Rust
  • Rust in the browser
  • Creating a React component
  • Web components entirely in Rust
  • Refactoring JavaScript revisited
  • Summary
  • Chapter 10: WebAssembly interface for refactoring
  • WASI universal runtime
  • From the browser to the machine
  • Wasm library
  • Consuming Wasm
  • More Wasm
  • Wasm memory
  • Just the beginning
  • Summary
  • Index