1. Preface
    1. What Is Async Rust?
    2. Who Is This Book For?
    3. Overview of the Chapters
    4. Conventions Used in This Book
    5. O’Reilly Online Learning
    6. How to Contact Us
    7. Acknowledgments
      1. Maxwell
      2. Caroline
  2. 1. Introduction to Async
    1. What Is Async?
    2. Introduction to Processes
    3. What Are Threads?
    4. Where Can We Utilize Async?
      1. Using Async for File I/O
      2. Improving HTTP Request Performance with Async
    5. Summary
  3. 2. Basic Async Rust
    1. Understanding Tasks
    2. Futures
      1. Pinning in Futures
      2. Context in Futures
    3. Waking Futures Remotely
    4. Sharing Data Between Futures
      1. High-Level Data Sharing Between Futures
      2. How Are Futures Processed?
    5. Putting It All Together
    6. Summary
  4. 3. Building Our Own Async Queues
    1. Building Our Own Async Queue
    2. Increasing Workers and Queues
    3. Passing Tasks to Different Queues
    4. Task Stealing
    5. Refactoring Our spawn_task Function
    6. Creating Our Own Join Macro
    7. Configuring Our Runtime
    8. Running Background Processes
    9. Summary
  5. 4. Integrating Networking into Our Own Async Runtime
    1. Understanding Executors and Connectors
    2. Integrating hyper into Our Async Runtime
    3. Building an HTTP Connection
    4. Implementing the Tokio AsyncRead Trait
    5. Implementing the Tokio AsyncWrite Trait
    6. Connecting and Running Our Client
    7. Introducing mio
      1. Polling Sockets in Futures
      2. Sending Data over the Socket
    8. Summary
  6. 5. Coroutines
    1. Introducing Coroutines
      1. What Are Coroutines?
      2. Why Use Coroutines?
    2. Generating with Coroutines
      1. Implementing a Simple Generator in Rust
      2. Stacking Our Coroutines
      3. Calling a Coroutine from a Coroutine
    3. Mimicking Async Behavior with Coroutines
    4. Controlling Coroutines
    5. Testing Coroutines
    6. Summary
  7. 6. Reactive Programming
    1. Building a Basic Reactive System
      1. Defining Our Subjects
      2. Building Our Display Observer
      3. Building Our Heater and Heat-Loss Observer
      4. Getting User Input via Callbacks
    2. Enabling Broadcasting with an Event Bus
      1. Building Our Event Bus Struct
      2. Building Our Event Bus Handle
      3. Interacting with Our Event Bus via Async Tasks
    3. Summary
  8. 7. Customizing Tokio
    1. Building a Runtime
    2. Processing Tasks with Local Pools
    3. Getting Unsafe with Thread Data
    4. Graceful Shutdowns
    5. Summary
  9. 8. The Actor Model
    1. Building a Basic Actor
    2. Working with Actors Versus Mutexes
    3. Implementing the Router Pattern
    4. Implementing State Recovery for Actors
    5. Creating Actor Supervision
    6. Summary
  10. 9. Design Patterns
    1. Building an Isolated Module
    2. Waterfall Design Pattern
    3. The Decorator Pattern
    4. The State Machine Pattern
    5. The Retry Pattern
    6. The Circuit-Breaker Pattern
    7. Summary
  11. 10. Building an Async Server with No Dependencies
    1. Setting Up the Basics
    2. Building Our std Async Runtime
      1. Building Our Waker
      2. Building Our Executor
      3. Running Our Executor
      4. Building Our Sender
      5. Building Our Receiver
      6. Building Our Sleep
    3. Building Our Server
      1. Accepting Requests
      2. Handling Requests
    4. Building Our Async Client
    5. Summary
  12. 11. Testing
    1. Performing Basic Sync Testing
    2. Mocking Async Code
    3. Testing For Deadlocks
    4. Testing for Race Conditions
    5. Testing Channel Capacity
    6. Testing Network Interactions
    7. Fine-Grained Future Testing
    8. Summary
  13. Index
  14. About the Authors