Async Rust - Helion
ISBN: 9781098149055
stron: 264, Format: ebook
Data wydania: 2024-11-12
Księgarnia: Helion
Cena książki: 177,65 zł (poprzednio: 227,76 zł)
Oszczędzasz: 22% (-50,11 zł)
Already popular among programmers for its memory safety and speed, the Rust programming language is also valuable for asynchrony. This practical book shows you how asynchronous Rust can help you solve problems that require multitasking. You'll learn how to apply async programming to solve problems with an async approach. You will also dive deeper into async runtimes, implementing your own ways in which async runtimes handle incoming tasks.
Authors Maxwell Flitton and Caroline Morton also show you how to implement the Tokio software library to help you with incoming traffic, communicate between threads with shared memory and channels, and design a range of complex solutions using actors. You'll also learn to perform unit and end-to-end tests on a Rust async system.
With this book, you'll learn:
- How Rust approaches async programming
- How coroutines relate to async Rust
- Reactive programming and how to implement pub sub in async rust
- How to solve problems using actors
- How to customize Tokio to gain control over how tasks are processed
- Async Rust design patterns
- How to build an async TCP server just using the standard library
- How to unit test async Rust
By the end of the book, you'll be able to implement your own async TCP server completely from the standard library with zero external dependencies, and unit test your async code.
Osoby które kupowały "Async Rust", wybierały także:
- Windows Media Center. Domowe centrum rozrywki 66,67 zł, (8,00 zł -88%)
- Ruby on Rails. Ćwiczenia 18,75 zł, (3,00 zł -84%)
- Przywództwo w świecie VUCA. Jak być skutecznym liderem w niepewnym środowisku 58,64 zł, (12,90 zł -78%)
- Scrum. O zwinnym zarządzaniu projektami. Wydanie II rozszerzone 58,64 zł, (12,90 zł -78%)
- Od hierarchii do turkusu, czyli jak zarządzać w XXI wieku 58,64 zł, (12,90 zł -78%)
Spis treści
Async Rust eBook -- spis treści
- Preface
- What Is Async Rust?
- Who Is This Book For?
- Overview of the Chapters
- Conventions Used in This Book
- OReilly Online Learning
- How to Contact Us
- Acknowledgments
- Maxwell
- Caroline
- 1. Introduction to Async
- What Is Async?
- Introduction to Processes
- What Are Threads?
- Where Can We Utilize Async?
- Using Async for File I/O
- Improving HTTP Request Performance with Async
- Summary
- 2. Basic Async Rust
- Understanding Tasks
- Futures
- Pinning in Futures
- Context in Futures
- Waking Futures Remotely
- Sharing Data Between Futures
- High-Level Data Sharing Between Futures
- How Are Futures Processed?
- Putting It All Together
- Summary
- 3. Building Our Own Async Queues
- Building Our Own Async Queue
- Increasing Workers and Queues
- Passing Tasks to Different Queues
- Task Stealing
- Refactoring Our spawn_task Function
- Creating Our Own Join Macro
- Configuring Our Runtime
- Running Background Processes
- Summary
- 4. Integrating Networking into Our Own Async Runtime
- Understanding Executors and Connectors
- Integrating hyper into Our Async Runtime
- Building an HTTP Connection
- Implementing the Tokio AsyncRead Trait
- Implementing the Tokio AsyncWrite Trait
- Connecting and Running Our Client
- Introducing mio
- Polling Sockets in Futures
- Sending Data over the Socket
- Summary
- 5. Coroutines
- Introducing Coroutines
- What Are Coroutines?
- Why Use Coroutines?
- Generating with Coroutines
- Implementing a Simple Generator in Rust
- Stacking Our Coroutines
- Calling a Coroutine from a Coroutine
- Mimicking Async Behavior with Coroutines
- Controlling Coroutines
- Testing Coroutines
- Summary
- Introducing Coroutines
- 6. Reactive Programming
- Building a Basic Reactive System
- Defining Our Subjects
- Building Our Display Observer
- Building Our Heater and Heat-Loss Observer
- Getting User Input via Callbacks
- Enabling Broadcasting with an Event Bus
- Building Our Event Bus Struct
- Building Our Event Bus Handle
- Interacting with Our Event Bus via Async Tasks
- Summary
- Building a Basic Reactive System
- 7. Customizing Tokio
- Building a Runtime
- Processing Tasks with Local Pools
- Getting Unsafe with Thread Data
- Graceful Shutdowns
- Summary
- 8. The Actor Model
- Building a Basic Actor
- Working with Actors Versus Mutexes
- Implementing the Router Pattern
- Implementing State Recovery for Actors
- Creating Actor Supervision
- Summary
- 9. Design Patterns
- Building an Isolated Module
- Waterfall Design Pattern
- The Decorator Pattern
- The State Machine Pattern
- The Retry Pattern
- The Circuit-Breaker Pattern
- Summary
- 10. Building an Async Server with No Dependencies
- Setting Up the Basics
- Building Our std Async Runtime
- Building Our Waker
- Building Our Executor
- Running Our Executor
- Building Our Sender
- Building Our Receiver
- Building Our Sleep
- Building Our Server
- Accepting Requests
- Handling Requests
- Building Our Async Client
- Summary
- 11. Testing
- Performing Basic Sync Testing
- Mocking Async Code
- Testing For Deadlocks
- Testing for Race Conditions
- Testing Channel Capacity
- Testing Network Interactions
- Fine-Grained Future Testing
- Summary
- Index