How return borrowed value from function?

use reqwest;
use scraper::{html::Select, Html, Selector};

async fn get_links() -> Result<Select, reqwest::Error> {

let res =
    let text = res.text().await?;
    let doc = Html::parse_document(&text);
    let sel = Selector::parse(
    let links =;
                            ---- `sel` is borrowed here
    ^^^^^^^^^^ returns a value referencing data owned by the current function

Here links is an iterator, do you want to return one? You could also collect.

   |        ^^^^^^^^^^^^^^^^ value of type `scraper::html::Select<'_, '_>` cannot be built from `std::iter::Iterator<Item=scraper::element_ref::ElementRef<'_>>`

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.