mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
398 B
17 lines
398 B
7 months ago
|
extern crate trpl; // required for mdbook test
|
||
|
|
||
|
use trpl::Html;
|
||
|
|
||
|
fn main() {
|
||
|
// TODO: we'll add this next!
|
||
|
}
|
||
|
|
||
|
async fn page_title(url: &str) -> Option<String> {
|
||
|
// ANCHOR: chaining
|
||
|
let response_text = trpl::get(url).await.text().await;
|
||
|
// ANCHOR_END: chaining
|
||
|
Html::parse(&response_text)
|
||
|
.select_first("title")
|
||
|
.map(|title_element| title_element.inner_html())
|
||
|
}
|