Avoid async pitfalls in Rust by ensuring all async functions are awaited, using .await on futures, and handling errors with Result types.
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())
}
Always chain .await calls immediately after async operations to prevent blocking or dropping futures.