|
1 |
| -# Asynchronous Programming in Rust |
| 1 | +# Asynchronous Programming in Rust |
2 | 2 |
|
3 |
| -This is the repository for the book: _Asynchronous Programming in Rust_. |
| 3 | +<a href="https://www.packtpub.com/product/asynchronous-programming-in-rust/9781805128137"><img src="https://content.packt.com/B20892/cover_image_small.jpg" alt="no-image" height="256px" align="right"></a> |
4 | 4 |
|
5 |
| -Written by Carl Fredrik Samson, published by Packt |
| 5 | +This is the code repository for [Asynchronous Programming in Rust](https://www.packtpub.com/product/asynchronous-programming-in-rust/9781805128137), published by Packt. |
6 | 6 |
|
7 |
| -## How to use this repository |
| 7 | +**Learn asynchronous programming by building working examples of futures, green threads, and runtimes** |
8 | 8 |
|
9 |
| -My clear recommendation is to clone this repository by either clicking on the `<> Code` button and select "Download ZIP" or clone the repository using your preferred git client. |
| 9 | +## What is this book about? |
| 10 | +Explore the nuances of transitioning from high-level languages to Rust with this book. Navigate potential frustrations arising from differences in modeling asynchronous program flow and recognize the need for a fundamental understanding of the topic. |
10 | 11 |
|
11 |
| -Each chapter has its own folder in this repository. Each example is organized as a standalone crate within that folder. |
| 12 | +This book covers the following exciting features: |
| 13 | +* Explore the essence of asynchronous program flow and its significance |
| 14 | +* Understand the difference between concurrency and parallelism |
| 15 | +* Gain insights into how computers and operating systems handle concurrent tasks |
| 16 | +* Uncover the mechanics of async/await |
| 17 | +* Understand Rust’s futures by implementing them yourself |
| 18 | +* Implement green threads from scratch to thoroughly understand them |
12 | 19 |
|
13 |
| -When encountering examples in the book, you might find it easier to read the code in the repository since you'll be able to open it up in the editor of your choice and have appropriate highlighting and formatting. |
| 20 | +If you feel this book is for you, get your [copy](https://www.amazon.com/Asynchronous-Programming-Rust-asynchronous-programming/dp/1805128132/ref=sr_1_1?crid=2NQEFXDPADDSG&keywords=asynchronous+programming+in+rust&qid=1707141670&sprefix=asynchronous+programming+in+r%2Caps%2C313&sr=8-1) today! |
14 | 21 |
|
15 |
| -Even if you only write the examples directly from the book line by line, you'll need the repository for `delayserver` and `corofy` which is two tools I wrote to help in the learning process. |
| 22 | +## Instructions and Navigations |
| 23 | +All of the code is organized into folders. For example, Chapter02. |
16 | 24 |
|
17 |
| -## Delayserver |
| 25 | +The code will look like the following: |
| 26 | +``` |
| 27 | +pub trait Future { |
| 28 | +type Output; |
| 29 | +fn poll(&mut self) -> PollState<Self::Output>; |
| 30 | +} |
18 | 31 |
|
19 |
| -Most of the examples will use a program called delayserver that's provided in this repository. Delayserver is a simple local webserver where you can write a HTTP GET request with a configurable delay. |
| 32 | +``` |
20 | 33 |
|
21 |
| -You have two options for running the delayserver: |
| 34 | +**Following is what you need for this book:** |
22 | 35 |
|
23 |
| -1. Go to the folder named `/delayserver` and write `cargo run` in a separate terminal window and leave it running there |
24 |
| -2. Go to the same folder and install the server by writing `cargo install --force --path .`. By doing so you install the program locally in you PATH so you can run it from any location by simply writing `delayserver` and leave the terminal process running. |
| 36 | +This book is for programmers who want to enhance their understanding of asynchronous programming, especially those experienced in VM’ed or interpreted languages like C#, Java, Python, JavaScript, and Go. If you work with C or C++ but have had limited exposure to asynchronous programming, this book serves as a resource to broaden your knowledge in this area. |
| 37 | +Although the examples are predominantly in Rust, the intricacies of Rust’s futures are covered in detail. So, anyone with a keen interest in learning Rust or with working knowledge of Rust will be able to get the most out of this book. |
25 | 38 |
|
26 |
| -How delayserver works is described in the book, but you'll also find the relevant information in its root folder. |
| 39 | +With the following software and hardware list you can run all code files present in the book (Chapter 1-10). |
| 40 | +### Software and Hardware List |
| 41 | +| Chapter | Software required | OS required | |
| 42 | +| -------- | ------------------------------------ | ----------------------------------- | |
| 43 | +| 1-10 | Rust (version 1.51 or later) | Windows, macOS, or Linux | |
27 | 44 |
|
28 |
| -## Corofy |
29 | 45 |
|
30 |
| -Corofy is another tool that we'll use from chapter 7 onwards. I recommend installing this tool locally by entering the folder `ch7/corofy` and installing it on your machine by writing `cargo install --force --path .` |
| 46 | +### Related products |
| 47 | +* Hands-On Concurrency with Rust [[Packt]](https://www.packtpub.com/product/hands-on-concurrency-with-rust/9781788399975) [[Amazon]](https://www.amazon.com/Hands-Concurrency-Rust-Confidently-memory-safe/dp/1788399978/ref=sr_1_1?crid=1S3COJO6XGV3Z&keywords=Hands-On+Concurrency+with+Rust&qid=1707141930&sprefix=hands-on+concurrency+with+rust%2Caps%2C291&sr=8-1) |
31 | 48 |
|
32 |
| -## I'll be going on a plane, how can I use the repository in an offline situation? |
| 49 | +* Hands-On Microservices with Rust [[Packt]](https://www.amazon.com/Hands-Microservices-Rust-scalable-microservices/dp/1789342759/ref=sr_1_1?crid=29U7MSUFK21FC&keywords=Hands-On+Microservices+with+Rust&qid=1707141998&sprefix=hands-on+concurrency+with+rust%2Caps%2C863&sr=8-1) [[Amazon]](https://www.amazon.com/Hands-Microservices-Rust-scalable-microservices/dp/1789342759/ref=sr_1_1?crid=29U7MSUFK21FC&keywords=Hands-On+Microservices+with+Rust&qid=1707141998&sprefix=hands-on+concurrency+with+rust%2Caps%2C863&sr=8-1) |
33 | 50 |
|
34 |
| -You'll need to install both `delayserver` and `corofy` locally on your machine while you're online. The process is described above. |
35 |
| - |
36 |
| -Most of the examples have no external dependencies, but from chapter 6 onwards |
37 |
| -we will have some of them. The best way to be able to run these examples while offline is to enter each folder and use [cargo vendor](https://doc.rust-lang.org/cargo/commands/cargo-vendor.html) to vendor the dependencies locally. This way you'll be able to build and experiment with the examples even though you'll be offline. |
38 |
| - |
39 |
| ----- |
40 |
| - |
41 |
| -Asynchronous Programming in Rust, published by Packt |
| 51 | +## Get to Know the Author |
| 52 | +**Carl Fredrik Samson** is a popular technical writer, and his favorite topics to write about are asynchronous programming and Rust. During a period of 3 years, Carl set out to cover topics about asynchronous programming that he felt were severely under explained and tried to explain them in an informal and easy to understand manner. The bits and pieces he wrote were popular and translated to several languages. Some even ended up as parts of the official Asynchronous Programming in Rust book. Now, he has decided to put his combined works and knowledge into a book of its own. Carl has programmed since the early 1990s, has a Master in Strategy and Finance, and he has written production software for both his own business and as a hobby for over a decade. |
0 commit comments