Commit Graph

5324 Commits

Author SHA1 Message Date
Chris Krycho
bea8557708 Ch. 17 §06: Start discussing future/task/thread tradeoffs
- Reintroduce accidentally-dropped content. I meant to simply carry this
  over in 74df84ea, but failed to, perhaps because I had `mdbook serve`
  running and it tries to be helpful about generating files which are
  referenced in `SUMMARY.md` but do not exist on disk. Either way, this
  is back now and we can use it to explain these concepts.

- Start on an example showing how `thread::spawn` and `spawn_task` are
  basically interchangeable from an API POV, so that we can then see how
  they differ in terms of runtime consequences.
2024-06-26 11:50:16 -06:00
Chris Krycho
3c6c32cbe3 Ch. 17 §05: complete example with throttle and take 2024-06-25 15:10:22 -06:00
Chris Krycho
e71b667806 Ch. 17 §05: First part of final example, with ReceiverStream 2024-06-25 14:57:45 -06:00
Chris Krycho
b4f5763368 Ch. 17: final example for §05, with more re-exported streams
Use `IntervalStream` and `ReceiverStream` to show the composition of
multiple streams, along with throttling and timeouts. This will also
provide a useful foundation for discussing the relationships between
futures, tasks, and threads in the final sections of the book, since
you can accomplish the same basic API by simply substituting threads
for tasks—but with different tradeoffs!
2024-06-25 14:57:45 -06:00
Chris Krycho
ce9b286b8f Ch. 17 §05: describe how to use Streams with Iterators
Also start laying the foundation for (a) showing how that interacts with
previous material, e.g. around slow operations; and (b) showing how it
composes nicely with other async operations, e.g. timeouts, throttling,
and (maybe!) even merging streams.
2024-06-20 16:12:01 -06:00
Chris Krycho
e790c2cc90 Ch. 17: re-export Stream, StreamExt, and stream_iter in trpl 2024-06-20 13:45:50 -06:00
Chris Krycho
bf5e4aa687 Ch. 17 (infra): add a base listing to use when generating new ones 2024-06-20 10:18:49 -06:00
Chris Krycho
cd1a3f7d09 Merge main into only-new-async 2024-06-20 10:18:49 -06:00
Chris Krycho
e3ab302d27 Ch. 17: Remove a now-properly-numbered listing
I moved this into dedicated listings appropriately but forgot to remove
the original.
2024-06-20 10:18:49 -06:00
Chris Krycho
a99d21f87a Merge pull request #3962 from rust-lang/ignore-nova
infra: ignore Nova configuration directory
2024-06-20 10:10:32 -06:00
Chris Krycho
1e41a9a52a infra: ignore Nova configuration directory 2024-06-20 10:06:20 -06:00
Chris Krycho
52c516c593 Ch. 17 §05: start explaining how we work with streams 2024-06-19 10:47:13 -06:00
Chris Krycho
ad360d7fe4 Ch 17. §01: leave a TODO about IntoFuture 2024-06-19 10:46:56 -06:00
Chris Krycho
a05c34eaa9 Ch. 17 §05: Introduce Stream and drop AsyncIterator 2024-06-18 08:16:11 -06:00
Chris Krycho
f0825ad05c Ch. 17 S§02: introduce and explain while let syntax.
This is actually the first time it appears in the book, to my great
surprise! We will also need to update Chapter 19 to account for having
introduced this form already, following the example for how it handles
Chapter 6’s introduction of `if let`.
2024-06-18 07:40:15 -06:00
Chris Krycho
74df84eaed Ch. 17: Add a new §05 on Stream and AsyncIterator
This pushes back the Tasks, Futures, and Threads discussion one more
spot, to become §06.
2024-06-17 13:29:44 -06:00
Chris Krycho
c0c24e2c86 Ch. 17 §02: transition for §03 and TODO cleanup 2024-06-17 11:36:40 -06:00
Chris Krycho
4598e2cb4f Ch. 17 §01: make the conclusion section coherent 2024-06-17 11:25:37 -06:00
Chris Krycho
d73e89368f Merge main into only-new-async 2024-06-14 10:28:01 -06:00
Chris Krycho
45c1a6d69e Merge pull request #3959 from bzierk/ch12-ch14
Convert Chapters 12-14
2024-06-14 10:25:20 -06:00
Chris Krycho
4f93e8b19f Ch. 17: finish listing numbers for §04 2024-06-14 09:57:16 -06:00
Chris Krycho
9d8f2c5fa7 Ch. 17: renumber listings to eliminate no-listing listings 2024-06-14 09:41:02 -06:00
Chris Krycho
fb683c9965 Ch. 17 §03: correct listings and wording for first half of section 2024-06-14 09:22:51 -06:00
bryanzierk
c7462f3a15 Revert chapter 15 2024-06-13 22:47:45 -05:00
Chris Krycho
91565da622 Ch. 17 §03: correct listings and wording for Pin materials 2024-06-13 13:58:56 -06:00
Chris Krycho
686b3e4f68 Ch. 17 §03: add a TODO for checking Pin description correctness 2024-06-13 13:45:20 -06:00
Chris Krycho
67bd0a08bc Ch. 17 §03: support code for motivating Pin
- Rexport `tokio::fs::read_to_string` as `trpl::read_to_string`.
- Add a no-listing example for the mutable borrow example. This will
  keep us honest that the code there itself compiles just fine!
2024-06-13 13:38:38 -06:00
Chris Krycho
2b65e53466 Ch. 17 §03: correct numbering and content for Listings 17-19 and 17-20 2024-06-13 13:23:51 -06:00
Chris Krycho
b8ecdb5c86 Ch. 17 §03: extract a no-listing for type mismatches 2024-06-13 12:42:08 -06:00
Chris Krycho
911167d473 Ch. 17: Remove completed TODO for Pin 🎉 2024-06-13 12:40:29 -06:00
Chris Krycho
a1eb8ae8e7 Ch. 17: Fix internal links
- Align them with the existing format for links.
- Add one missing link.
2024-06-13 12:40:01 -06:00
Chris Krycho
6035ba4315 Ch. 17 §03: correct numbering and content for Listing 17-18 2024-06-13 10:29:15 -06:00
Chris Krycho
c308400251 Ch. 17 §03: correct numbering and content for Listings 17-17 2024-06-13 10:26:15 -06:00
Chris Krycho
766ad04fb2 Ch. 17 §02: correct numbering and content for Listings 17-15 and 17-16 2024-06-13 10:22:23 -06:00
Chris Krycho
7e5b6f2c7d Ch. 17 §02: correct numbering and content for Listings 17-13 and 17-14 2024-06-13 10:12:25 -06:00
Chris Krycho
60cde0097b Ch. 17 §02: correct numbering and content for Listing 17-12 2024-06-13 10:12:25 -06:00
Chris Krycho
38ddc49c60 Ch. 17 §02: correct numbering and content for Listings 17-10 and 17-11 2024-06-13 10:12:25 -06:00
Chris Krycho
6d802a08fc Ch. 17 §02: correct numbering and content for Listings 17-08 and 17-09 2024-06-13 10:12:25 -06:00
Chris Krycho
bd26083b6d Ch. 17 §02: leave a TODO about one bucket of output
This one may or may not make sense: the output *order* should be the
same regardless, but there will be a *lot* of extra noise in it because
of the `cargo build` output before the actual program output, and we do
not appear to have a good way to focus on particular subsets of output
the way we do for code?
2024-06-13 09:23:20 -06:00
Chris Krycho
6fd549dc22 Ch. 17 §02: correct numbering and content for Listing 17-07 2024-06-13 09:23:20 -06:00
Chris Krycho
4c41d8f015 Ch. 17 §02: remove listing that I split into multiple parts 2024-06-13 09:23:20 -06:00
Chris Krycho
4c4ebb7bb5 Ch. 17 §02: correct numbering and content for Listing 17-06 2024-06-13 09:23:20 -06:00
Chris Krycho
ccd68087cd Ch. 17 §02: correct numbering and content for Listing 17-05 2024-06-13 09:23:20 -06:00
Chris Krycho
dc0ce20366 Merge main into only-new-async 2024-06-13 09:23:20 -06:00
Chris Krycho
69323d90da Ch. 17 §02: correct numbering and content for Listing 17-04 2024-06-13 09:23:20 -06:00
Chris Krycho
047226f473 Merge pull request #3958 from rust-lang/admin-tasks-typo
Fix a typo in `ADMIN_TASKS`
2024-06-13 08:32:45 -06:00
Chris Krycho
dc27455c74 Fix a typo in ADMIN_TASKS 2024-06-13 08:26:49 -06:00
Chris Krycho
c310f54aab Ch. 17: Finish (first pass) documentation for trpl::race
Explain how it relates to `futures::future::select` and why `trpl` uses
`race` semantics instead.
2024-06-13 08:14:22 -06:00
Chris Krycho
217645eb35 Ch. 17 §01: flag a TODO item for later 2024-06-13 08:14:22 -06:00
Chris Krycho
5458a6a4d4 Ch. 17: correct listing numbers for §01 2024-06-13 08:14:22 -06:00