Fix typos in Chapter 1 code samples

This commit is contained in:
Tyler Mandry 2019-10-15 16:50:55 -07:00 committed by Taylor Cramer
parent dc7b321ff9
commit b726cb8e4a
1 changed files with 5 additions and 5 deletions

View File

@ -16,8 +16,8 @@ fn download(_url: &str) {
// ANCHOR: get_two_sites
fn get_two_sites() {
// Spawn two threads to do work.
let thread_one = thread::spawn(|| download("https:://www.foo.com"));
let thread_two = thread::spawn(|| download("https:://www.bar.com"));
let thread_one = thread::spawn(|| download("https://www.foo.com"));
let thread_two = thread::spawn(|| download("https://www.bar.com"));
// Wait for both threads to complete.
thread_one.join().expect("thread one panicked");
@ -33,11 +33,11 @@ async fn download_async(_url: &str) {
async fn get_two_sites_async() {
// Create a two different "futures" which, when run to completion,
// will asynchronously download the webpages.
let future_one = download_async("https:://www.foo.com");
let future_two = download_async("https:://www.bar.com");
let future_one = download_async("https://www.foo.com");
let future_two = download_async("https://www.bar.com");
// Run both futures to completion at the same time.
join!(future_one, future_two);
join!(future_one, future_two).await;
}
// ANCHOR_END: get_two_sites_async