How to use async streams

Use the await keyword on async functions to handle non-blocking I/O operations efficiently in Rust.

Use the await keyword on async functions to pause execution until a result is ready, or chain calls to process data sequentially.

use trpl::Html;

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

This pattern fetches data from a URL and extracts the HTML title without blocking the main thread.