Commit Graph

44 Commits

Author SHA1 Message Date
Bene d4d750523a Review Fixes. Thanks to @eholk 2023-05-05 09:11:10 +02:00
Nereuxofficial 87ac3cbdd3
Merge branch 'rust-lang:master' into spawning 2023-05-05 08:38:48 +02:00
Eric Holk 41023fbb55
Merge pull request #194 from bravequickcleverfibreyarn/6_3_select_example
Obviously old comment removal
2023-03-30 10:47:56 -07:00
JirCep fc9038c140 Obviously old comment removal 2023-02-13 22:25:41 +01:00
Bruno Paulino bac695815a
Remove unecessary pointer dereferencing 2023-02-12 17:49:16 +01:00
Bene c618588efc Updated async dependency 2023-02-03 12:15:45 +01:00
Bene 0f396afde7 Removed test for local testing 2023-02-02 14:16:23 +01:00
Bene 6957e04fba Added Spawning example 2023-02-02 14:12:50 +01:00
Emilia Hane 81c03c260f Remove unnecessary code from example 2022-07-30 20:17:35 +09:00
Taiki Endo a7974c8de8 Unify import style 2022-07-30 18:19:56 +09:00
Taiki Endo 1fb57ec5dd Add missing html files 2022-07-30 18:16:47 +09:00
Taiki Endo e409a5c10f Migrate to Rust 2021 2022-07-30 18:07:23 +09:00
d2weber 9b936d43d9 Add time::Duration import to snippet 2022-07-24 20:34:19 +09:00
StevenJiang1110 9cdcfcbd8c Remove unused use-statement 2022-07-01 00:20:58 +09:00
Samuel Tardieu 73cdf319ab Use write_all() to ensure that the whole response gets sent 2022-01-19 18:02:54 +09:00
Samuel Tardieu 9cc89b5a7e Use more modern interpolation 2022-01-16 18:50:02 +09:00
Dima Pristupa 66e6d20768 🚨 MockTcpStream::poll_write(): remove extra "return" keyword 2021-10-26 23:15:45 +09:00
Dima Pristupa 3bd440f4b6 🎨 Add blank lines between impl Write for MockTcpStream methods 2021-10-26 23:15:45 +09:00
Dima Pristupa 906fdef2ef 🚨 Fix a rust-clippy warning
* https://rust-lang.github.io/rust-clippy/master/#redundant_pattern_matching
2021-10-26 23:15:45 +09:00
Dima Pristupa a86d9c5f73 ✏️ Add spaces around em dashes 2021-10-26 23:15:45 +09:00
Yuli Mo 2d7c1fe8ed fix(Chapter 9): ensure src and dst has same size before copy_from_slice
* the example code will panic when the capacity of buf is bigger than
 self.read_data
2020-11-17 23:50:08 +08:00
Lee Bernick 089bbd766e Add section on async crates, runtimes, and multithreading
Co-authored-by: Didrik Nordström <didrik.nordstrom@gmail.com>
2020-10-26 11:08:37 -04:00
Jonas Platte 46c28becc1 Remove redundant braces from timer example imports 2020-09-27 05:52:14 +09:00
Lee Bernick 87015e2183
More beginner-friendly TCP server example (#102)
I wanted to write an example to help guide people new to asynchronous programming, with fewer external dependencies (as some people requested in #66). The example starts with the [single threaded TCP server from the Rust book](https://doc.rust-lang.org/book/ch20-01-single-threaded.html) and uses async functionality to add concurrency.
The example goes through:
- some examples of blocking code and how to make them non blocking (should address #64 as well)
- spawning tasks vs using combinators to run them concurrently on a single thread
- testing code by creating mocks and implementing async read/write traits for the mocks
2020-09-16 16:00:12 -07:00
JR Heard 1865ce05b9 Fix typo in executor section 2020-08-25 14:44:12 +09:00
Akshat Agarwal 3a9add9417 Update Cargo.toml
Adding `futures` to `[dev-dependencies]` shows this error. Adding it to `[dependencies]` fixes it
```
error[E0433]: failed to resolve: use of undeclared type or module `futures`
 --> src/main.rs:1:5
  |
1 | use futures::executor::block_on;
  |     ^^^^^^^ use of undeclared type or module `futures`

error[E0425]: cannot find function `block_on` in this scope
 --> src/main.rs:9:5
  |
9 |     block_on(future);
  |     ^^^^^^^^ not found in this scope

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `async-l`.

To learn more, run the command again with --verbose.
```
2020-06-12 06:09:33 +09:00
Taiki Endo 8121c2ee24 Fix invalid package names
Refs: https://github.com/rust-lang/cargo/pull/7959
2020-06-12 06:07:35 +09:00
Koxiaet 6d00be56a9 Updated HTTP server example:
- Updated reqwest.
- Replaced failure with anyhow.
- Corrected documentation about services.
2020-05-22 23:15:40 +09:00
Hernando Castano 109a7445e0 Fix typo 2020-04-28 12:39:17 -07:00
Jens Krause 588b3bd048 Update chapter 1.4
for using latest `Hyper` `v.0.13.0`, which supports `async/await` out of
the box.
2020-02-03 09:44:24 -08:00
Arne Janbu fa3228386e Chapter 1: Fix typo in comment 2019-11-14 14:40:42 -08:00
petrSchreiber a276e7ebdc fix: remove nightly references 2019-11-14 10:19:05 -08:00
Tyler Mandry ea72c9e5ab Update examples/01_02_why_async/src/lib.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-11-13 12:28:45 -08:00
Tyler Mandry b726cb8e4a Fix typos in Chapter 1 code samples 2019-11-13 12:28:45 -08:00
Peter Trotman ff6b79630d
added space to closing `}` around task_sender 2019-09-09 14:44:34 +01:00
Taylor Cramer b3467d9f9f Add chapter: Workarounds to Know and Love 2019-09-05 09:59:03 -07:00
Taiki Endo 2bdc0a1d77 Remove async_await feature 2019-08-22 15:16:46 -07:00
Taylor Cramer e7f09f36f7 Add sections for select and join 2019-08-08 18:13:10 -07:00
Taylor Cramer bcddf59880 Update to futures alpha.17 2019-08-08 18:13:10 -07:00
utsavoza 822a3d3765 Fix typo in examples/02_04_executor 2019-07-25 12:48:13 -07:00
Taylor Cramer 64e93ffb85 Update mdbook and use ANCHOR for code includes 2019-07-24 10:04:17 -07:00
Joe Clay da8610846f Fix some references to the old await! syntax (#21) 2019-07-09 16:48:28 +02:00
Taylor Cramer c46bb09bfa Reduce wordiness 2019-06-14 11:34:15 -07:00
Taylor Cramer 44c8f61abc Update examples and move into cargo projects
This allows us to test examples and confirm that they
are both correct and that they continue to work in
spite of upstream changes.
2019-06-13 17:18:07 -07:00