Add code for running the async functions
This commit is contained in:
parent
6e852c6c60
commit
9e59d39384
1 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,15 @@
|
|||
use trpl::Html;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
|
||||
trpl::run(async {
|
||||
let url = &args[1];
|
||||
match page_title(url).await {
|
||||
Some(title) => println!("The title for {url} was {title}"),
|
||||
None => println!("{url} had no title"),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async fn page_title(url: &str) -> Option<String> {
|
||||
|
|
Loading…
Reference in a new issue