Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation of FnOnce is not general enough #85

Open
CezarGarrido opened this issue Feb 16, 2024 · 0 comments
Open

implementation of FnOnce is not general enough #85

CezarGarrido opened this issue Feb 16, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@CezarGarrido
Copy link

CezarGarrido commented Feb 16, 2024

I'm trying to run it in a separate task, but I'm running into this problem:

error: implementation of `Iterator` is not general enough
   --> src/pages/download.rs:128:25
    |
128 | /                         task::spawn(async move {
129 | |                             let summaries = downloader.download(&downloads.to_vec()).await;
130 | |
131 | |                             display_summary(&summaries);
132 | |                         });
    | |__________________________^ implementation of `Iterator` is not general enough
    |
    = note: `Iterator` would have to be implemented for the type `std::slice::Iter<'0, Download>`, for any lifetime `'0`...
    = note: ...but `Iterator` is actually implemented for the type `std::slice::Iter<'1, Download>`, for some specific lifetime `'1`


                        let cloned_files_url: Vec<HashMap<String, String>> = files_url.clone();
                        let mut downloads = vec![];

                        for f in cloned_files_url {
                            let url = f.get("url").unwrap();
                            //let file_name = f.get("name").unwrap(); // nome do arquivo
                            let d = Download::try_from(url.as_str()).unwrap();
                            downloads.push(d);
                        }

                        let downloader = DownloaderBuilder::new()
                            .directory(PathBuf::from("output"))
                            .build();

                        task::spawn(async move {
                            let summaries = downloader.download(&downloads.to_vec()).await;

                            display_summary(&summaries);
                        });

trauma = "2.2.4"
tokio = "1.36.0"

@CezarGarrido CezarGarrido added the kind/bug Something isn't working label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant