Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 17.1 - page_title example function referred to as page_url_for #220

Open
devindumke opened this issue Nov 4, 2024 · 0 comments
Open

Comments

@devindumke
Copy link

URL to the section(s) of the book with this problem:
https://rust-book.cs.brown.edu/ch17-01-futures-and-syntax.html

Description of the problem:
In Chapter 17.1 Futures and the Async Syntax, we create a function to demonstrate the async syntax:

use trpl::Html;

async fn page_title(url: &str) -> Option<String> {
    let response = trpl::get(url).await;
    let response_text = response.text().await;
    Html::parse(&response_text)
        .select_first("title")
        .map(|title_element| title_element.inner_html())
}

Later on in the page, we refer back to this function with the suggestion to modify it.

As a result, we can change the body of page_url_for to chain the trpl::get and text function calls together with await between them, as shown in Listing 17-2:

The above sentence implies that the function we should modify is page_url_for, but the function is called page_title. The term page_url_for does not show up anywhere in Chapter 17.

Suggested fix:
Change the sentence listed above in Chapter 17.1 to refer to the function as page_title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant