Error

"async fn was not .awaited" — What It Means

Fix the 'async fn was not .awaited' error by adding .await to the function call to execute the asynchronous task.

Error: "async fn was not .awaited" — What It Means means you called an async function but forgot to add .await to execute it, leaving a Future that does nothing until polled. Add .await to the function call inside an async context to run the operation.

use trpl;

#[trpl::main]
async fn main() {
    let result = page_title("https://example.com").await;
    println!("{result}");
}

async fn page_title(url: &str) -> String {
    let response = trpl::get(url).await;
    response.text().await
}