mirror of https://github.com/rust-lang/async-book
Fix typos in Chapter 1 code samples
This commit is contained in:
parent
dc7b321ff9
commit
b726cb8e4a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue