pub fn retrieve_packages(&mut self, solve: &Graph<Summary>) -> Res<Graph<Source>> {
        // let mut prg = 0;
        // Until pb.println gets added, we can't use progress bars
        // let pb = ProgressBar::new(solve.inner.raw_nodes().len() as u64);
        // pb.set_style(ProgressStyle::default_bar().template("  [-->] {bar} {pos}/{len}"));

        let sources = solve.map(
            |_, sum| {
                let loc = match sum.resolution() {
                    Resolution::Direct(direct) => direct,
                    Resolution::Index(_) => &self.indices.select(sum).unwrap().location,
                };

                if let Some(s) = self.sources.get_mut(sum.id()).and_then(|x| x.remove(loc)) {
                    // prg += 1;
                    // pb.set_position(prg);
                    Ok(s)
                } else {
                    self.shell.println(
                        style("Retrieving").cyan(),
                        sum.to_string(),
                        Verbosity::Normal,
                    );

                    let source = self
                        .cache
                        .checkout_source(sum.id(), loc)
                        .context(format_err!("unable to retrieve package {}", sum))?;
                    // prg += 1;
                    // pb.set_position(prg);
                    Ok(source)
                }
            },
            |_| Ok(()),
        )?;

        // pb.finish_and_clear();
        self.shell.println(
            style("Cached").dim(),
            format!("packages in {}", self.cache.layout.src.display()),
            Verbosity::Verbose,
        );

        Ok(sources)
    }
/// Loads all of the packages selected in a Solve into the Cache, returning a new graph of all
/// the Sources.
///
/// This downloads all the packages into the cache. If we wanted to parallelize downloads
/// later, this is where we'd deal with all the Tokio stuff.
Loads all of the packages selected in a Solve into the Cache, returning a new graph of all
the Sources.

This downloads all the packages into the cache. If we wanted to parallelize downloads
later, this is where we'd deal with all the Tokio stuff.
Loads all of the packages selected in a Solve into the Cache returning a new graph of all the Sources . This downloads all the packages into the cache . If we wanted to parallelize downloads later this is where we ' d deal with all the Tokio stuff .
pub fn retrieve_packages(&mut self, solve: &Graph<Summary>) -> Res<Graph<Source>> {
        // let mut prg = 0;
        // Until pb.println gets added, we can't use progress bars
        // let pb = ProgressBar::new(solve.inner.raw_nodes().len() as u64);
        // pb.set_style(ProgressStyle::default_bar().template("  [-->] {bar} {pos}/{len}"));
        let sources = solve.map(
            |_, sum| {
                let loc = match sum.resolution() {
                    Resolution::Direct(direct) => direct,
                    Resolution::Index(_) => &self.indices.select(sum).unwrap().location,
                };
                if let Some(s) = self.sources.get_mut(sum.id()).and_then(|x| x.remove(loc)) {
                    // prg += 1;
                    // pb.set_position(prg);
                    Ok(s)
                } else {
                    self.shell.println(
                        style("Retrieving").cyan(),
                        sum.to_string(),
                        Verbosity::Normal,
                    );
                    let source = self
                        .cache
                        .checkout_source(sum.id(), loc)
                        .context(format_err!("unable to retrieve package {}", sum))?;
                    // prg += 1;
                    // pb.set_position(prg);
                    Ok(source)
                }
            },
            |_| Ok(()),
        )?;
        // pb.finish_and_clear();
        self.shell.println(
            style("Cached").dim(),
            format!("packages in {}", self.cache.layout.src.display()),
            Verbosity::Verbose,
        );
        Ok(sources)
    }
pub fn retrieve_packages ( & mut self , solve : & Graph < Summary > ) -> Res < Graph < Source > > { // let mut prg = 0; // Until pb.println gets added, we can't use progress bars // let pb = ProgressBar::new(solve.inner.raw_nodes().len() as u64); // pb.set_style(ProgressStyle::default_bar().template("  [-->] {bar} {pos}/{len}")); let sources = solve . map ( | _ , sum | { let loc = match sum . resolution ( ) { Resolution :: Direct ( direct ) => direct , Resolution :: Index ( _ ) => & self . indices . select ( sum ) . unwrap ( ) . location , } ; if let Some ( s ) = self . sources . get_mut ( sum . id ( ) ) . and_then ( | x | x . remove ( loc ) ) { // prg += 1; // pb.set_position(prg); Ok ( s ) } else { self . shell . println ( style ( " " ) . cyan ( ) , sum . to_string ( ) , Verbosity :: Normal , ) ; let source = self . cache . checkout_source ( sum . id ( ) , loc ) . context ( format_err ! ( " " sum ) ) ? ; // prg += 1; // pb.set_position(prg); Ok ( source ) } } , | _ | Ok ( ( ) ) , ) ? ; // pb.finish_and_clear(); self . shell . println ( style ( " " ) . dim ( ) , format ! ( " " self cache layout src display ( ) ) , Verbosity :: Verbose , ) ; Ok ( sources ) }
Loads all of the packages selected in a Solve into the Cache, returning a new graph of all
the Sources.
Loads all of the packages selected in a Solve into the Cache returning a new graph of all the Sources .
&mut self
solve
&Graph<Summary>