Lifetimes in async functions work the same as in regular functions: they ensure references remain valid for the duration of the future, but the compiler infers them automatically unless you explicitly annotate them. You typically only need to add lifetime annotations when an async function returns a reference tied to an input argument's lifetime.
use trpl::Html;
async fn page_title<'a>(url: &'a str) -> Option<String> {
let response_text = trpl::get(url).await.text().await;
Html::parse(&response_text)
.select_first("title")
.map(|title| title.inner_html())
}
Note: In most cases, Rust's lifetime elision rules apply, so you can omit the explicit 'a annotation unless the compiler demands it.