Skip to content

Commit

Permalink
Merge async-edits into only-new-async
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Aug 19, 2024
2 parents 58fff3c + fb718b3 commit ddad349
Show file tree
Hide file tree
Showing 99 changed files with 1,850 additions and 1,301 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@ jobs:
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
- name: Report versions
run: |
rustup --version
rustc -Vv
mdbook --version
# mdBook does not currently have particularly good support for “external”
# crates. To make the test suite work correctly with `trpl`, we must first
# build `trpl` itself (`mdbook` will not do it), and then explicitly pass
# its `deps` path as a library search path for `mdbook test`. That will make
# sure all the crates can be resolved when running the tests.
- name: Build `trpl` crate
run: |
cd packages/trpl
cargo build
- name: Run tests
run: mdbook test
run:
mdbook test --library-path packages/trpl/target/debug/deps
package_tests:
name: Run package tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,7 +76,7 @@ jobs:
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
- name: Install mdbook-trpl-note
run: cargo install --path packages/mdbook-trpl-note
- name: Install mdbook-trpl-listing
Expand All @@ -82,7 +93,7 @@ jobs:
aspell --version
shellcheck --version
- name: Shellcheck
run: find . -name '*.sh' | xargs shellcheck
run: find . -name '*.sh' -print0 | xargs -0 shellcheck
- name: Spellcheck
run: bash ci/spellcheck.sh list
- name: Lint for local file paths
Expand Down
4 changes: 2 additions & 2 deletions 2018-edition/src/ch17-03-oo-design-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
The 2018 edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch17-03-oo-design-patterns.html) instead.
version of the book](../ch18-03-oo-design-patterns.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
1.30](https://doc.rust-lang.org/1.30.0/book/2018-edition/ch17-03-oo-design-patterns.html).
1.30](https://doc.rust-lang.org/1.30.0/book/2018-edition/ch17-03-oo-design-patterns.html).
10 changes: 10 additions & 0 deletions ADMIN_TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,13 @@ $ dot dot/trpl04-01.dot -Tsvg > src/img/trpl04-01.svg
In the generated SVG, remove the width and the height attributes from the `svg`
element and set the `viewBox` attribute to `0.00 0.00 1000.00 1000.00` or other
values that don't cut off the image.

## Publish a preview to GitHub Pages

We sometimes publish to GitHub Pages for in-progress previews. The recommended
flow for publishing is:

- Install the `ghp-import` tool by running `pip install ghp-import` (or `pipx install ghp-import`, using [pipx][pipx]).
- In the root, run `tools/generate-preview.sh`

[pipx]: https://pipx.pypa.io/stable/#install-pipx
3 changes: 3 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ git-repository-url = "https://github.com/rust-lang/book"

[preprocessor.trpl-listing]
output-mode = "default"

[rust]
edition = "2021"
23 changes: 23 additions & 0 deletions ci/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ bool
boolean
Boolean
Booleans
booleans
Bors
BorrowMutError
BoxMeUp
Expand Down Expand Up @@ -109,6 +110,7 @@ deallocate
deallocated
deallocating
deallocation
debounce
debuginfo
decl
decrementing
Expand Down Expand Up @@ -145,6 +147,7 @@ DisplayBacktrace
DivAssign
DraftPost
DSTs
durations
ebook
ebooks
Edsger
Expand Down Expand Up @@ -179,6 +182,7 @@ filesystem's
filesystems
filmmaking
Firefox
FirstAwaitPoint
FnMut
FnOnce
formatter
Expand All @@ -197,6 +201,7 @@ grapheme
Grapheme
growable
gzip
handoff
hardcode
hardcoded
hardcoding
Expand Down Expand Up @@ -241,6 +246,7 @@ inline
instantiation
internet
interoperate
IntoFuture
IntoIterator
InvalidDigit
invariants
Expand All @@ -256,6 +262,7 @@ isize
iter
iterator's
JavaScript
JoinAll
JoinHandle
Kay's
kinded
Expand Down Expand Up @@ -294,6 +301,8 @@ Metadata
metaprogramming
mibbit
Mibbit
microcontroller
microcontrollers
millis
minigrep
mixup
Expand All @@ -307,17 +316,20 @@ monomorphized
MoveMessage
Mozilla
mpsc
MSRV
msvc
MulAssign
multibyte
multithreaded
multithreading
mutex
mutex's
Mutex
mutexes
Mutexes
MutexGuard
mutext
MyAsyncStateMachine
MyBox
myprogram
namespace
Expand Down Expand Up @@ -359,6 +371,7 @@ OutlinePrint
overloadable
overread
PanicPayload
parallelizable
param
parameterize
ParseIntError
Expand All @@ -371,6 +384,7 @@ PlaceholderType
polymorphism
PoolCreationError
portia
postfix
powershell
PowerShell
powi
Expand All @@ -396,6 +410,8 @@ RangeTo
RangeFull
README
READMEs
ReadFinished
ReceiverStream
rect
recurse
recv
Expand Down Expand Up @@ -438,6 +454,7 @@ sampleproject
screenshot
searchstring
SecondaryColor
SecondAwaitPoint
SelectBox
semver
SemVer
Expand All @@ -455,6 +472,7 @@ SliceIndex
Smalltalk
snuck
someproject
SomeType
someusername
SPDX
spdx
Expand All @@ -470,6 +488,7 @@ stdlib
stdout
steveklabnik's
stringify
StreamExt
Stroustrup
Stroustrup's
struct
Expand Down Expand Up @@ -514,6 +533,8 @@ tlborm
tlsv
TODO
TokenStream
Tokio
tokio
toml
TOML
toolchain
Expand All @@ -538,6 +559,7 @@ uncomment
Uncomment
uncommenting
unevaluated
unhandled
Uninstalling
uninstall
unittests
Expand All @@ -556,6 +578,7 @@ username
USERPROFILE
usize
UsState
util
utils
vals
variable's
Expand Down
44 changes: 44 additions & 0 deletions dot/trpl17-01.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
digraph {
dpi = 300.0;

rankdir = "LR";

// makes ordering between subgraphs work
newrank = true;

node [shape = diamond;];

subgraph cluster_task_a {
label = "Task A";

A1;
A2;
A3;
A4;

A1 -> A2 -> A3 -> A4 -> A0 [style = invis;];

// for vertical alignment purposes only
A0 [style = invis;];

// Makes the heights line up between the boxes.
A4 -> A0 [style = invis;];
}

subgraph cluster_task_b {
label = "Task B";

// for horizontal alignment purposes only
// newrank = true;

B0 [style = invis;];

B1;
B2;
B3;

B0 -> B1 -> B2 -> B3 [style = invis;];
}

A1 -> B1 -> A2 -> B2 -> A3 -> A4 -> B3;
}
20 changes: 20 additions & 0 deletions dot/trpl17-02.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
digraph {
dpi = 300.0;

rankdir = "LR";
splines = false;
cluster = true;

node [shape = diamond;];

subgraph cluster_ColleagueA {
newrank = true;
label = "Task 1";
A1 -> A2 -> A3 -> A4;
}

subgraph cluster_ColleagueB {
label = "Task 2";
B1 -> B2 -> B3;
}
}
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-04/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

// ANCHOR: main
fn main() {
trpl::block_on(async {
Expand Down
4 changes: 4 additions & 0 deletions listings/ch17-async-await/listing-17-05/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
extern crate trpl; // required for mdbook test

// ANCHOR: all
use std::time::Duration;

fn main() {
Expand All @@ -15,3 +18,4 @@ fn main() {
}
});
}
// ANCHOR_END: all
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-06/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-07/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-08/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

fn main() {
trpl::block_on(async {
// ANCHOR: channel
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-09/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-10/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-11/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-12/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
12 changes: 12 additions & 0 deletions listings/ch17-async-await/listing-17-13/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions listings/ch17-async-await/listing-17-13/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate trpl; // required for mdbook test

use std::time::Duration;

fn main() {
Expand Down
Loading

0 comments on commit ddad349

Please sign in to comment.