fn expand(&self, path_globs: PathGlobs) -> BoxFuture<Vec<PathStat>, E> {
    if path_globs.include.is_empty() {
      return future::ok(vec![]).to_boxed();
    }

    let init = PathGlobsExpansion {
      context: self.clone(),
      todo: path_globs.include,
      exclude: path_globs.exclude,
      completed: HashSet::default(),
      outputs: OrderMap::default(),
    };
    future::loop_fn(init, |mut expansion| {
      // Request the expansion of all outstanding PathGlobs as a batch.
      let round = future::join_all({
        let exclude = &expansion.exclude;
        let context = &expansion.context;
        expansion
          .todo
          .drain(..)
          .map(|path_glob| context.expand_single(path_glob, exclude))
          .collect::<Vec<_>>()
      });
      round.map(move |paths_and_globs| {
        // Collect distinct new PathStats and PathGlobs
        for (paths, globs) in paths_and_globs.into_iter() {
          expansion.outputs.extend(paths.into_iter().map(|p| (p, ())));
          let completed = &mut expansion.completed;
          expansion
            .todo
            .extend(globs.into_iter().filter(|pg| completed.insert(pg.clone())));
        }

        // If there were any new PathGlobs, continue the expansion.
        if expansion.todo.is_empty() {
          future::Loop::Break(expansion.outputs)
        } else {
          future::Loop::Continue(expansion)
        }
      })
    }).map(|expansion_outputs| {
      // Finally, capture the resulting PathStats from the expansion.
      expansion_outputs.into_iter().map(|(k, _)| k).collect()
    })
      .to_boxed()
  }
///
/// Recursively expands PathGlobs into PathStats while applying excludes.
///
Recursively expands PathGlobs into PathStats while applying excludes.
Recursively expands PathGlobs into PathStats while applying excludes .
fn expand(&self, path_globs: PathGlobs) -> BoxFuture<Vec<PathStat>, E> {
    if path_globs.include.is_empty() {
      return future::ok(vec![]).to_boxed();
    }
    let init = PathGlobsExpansion {
      context: self.clone(),
      todo: path_globs.include,
      exclude: path_globs.exclude,
      completed: HashSet::default(),
      outputs: OrderMap::default(),
    };
    future::loop_fn(init, |mut expansion| {
      // Request the expansion of all outstanding PathGlobs as a batch.
      let round = future::join_all({
        let exclude = &expansion.exclude;
        let context = &expansion.context;
        expansion
          .todo
          .drain(..)
          .map(|path_glob| context.expand_single(path_glob, exclude))
          .collect::<Vec<_>>()
      });
      round.map(move |paths_and_globs| {
        // Collect distinct new PathStats and PathGlobs
        for (paths, globs) in paths_and_globs.into_iter() {
          expansion.outputs.extend(paths.into_iter().map(|p| (p, ())));
          let completed = &mut expansion.completed;
          expansion
            .todo
            .extend(globs.into_iter().filter(|pg| completed.insert(pg.clone())));
        }
        // If there were any new PathGlobs, continue the expansion.
        if expansion.todo.is_empty() {
          future::Loop::Break(expansion.outputs)
        } else {
          future::Loop::Continue(expansion)
        }
      })
    }).map(|expansion_outputs| {
      // Finally, capture the resulting PathStats from the expansion.
      expansion_outputs.into_iter().map(|(k, _)| k).collect()
    })
      .to_boxed()
  }
fn expand ( & self , path_globs : PathGlobs ) -> BoxFuture < Vec < PathStat > , E > { if path_globs . include . is_empty ( ) { return future :: ok ( vec ! [ ] ) . to_boxed ( ) ; } let init = PathGlobsExpansion { context : self . clone ( ) , todo : path_globs . include , exclude : path_globs . exclude , completed : HashSet :: default ( ) , outputs : OrderMap :: default ( ) , } ; future :: loop_fn ( init , | mut expansion | { // Request the expansion of all outstanding PathGlobs as a batch. let round = future :: join_all ( { let exclude = & expansion . exclude ; let context = & expansion . context ; expansion . todo . drain ( .. ) . map ( | path_glob | context . expand_single ( path_glob , exclude ) ) . collect :: < Vec < _ > > ( ) } ) ; round . map ( move | paths_and_globs | { // Collect distinct new PathStats and PathGlobs for ( paths , globs ) in paths_and_globs . into_iter ( ) { expansion . outputs . extend ( paths . into_iter ( ) . map ( | p | ( p , ( ) ) ) ) ; let completed = & mut expansion . completed ; expansion . todo . extend ( globs . into_iter ( ) . filter ( | pg | completed . insert ( pg . clone ( ) ) ) ) ; } // If there were any new PathGlobs, continue the expansion. if expansion . todo . is_empty ( ) { future :: Loop :: Break ( expansion . outputs ) } else { future :: Loop :: Continue ( expansion ) } } ) } ) . map ( | expansion_outputs | { // Finally, capture the resulting PathStats from the expansion. expansion_outputs . into_iter ( ) . map ( | ( k , _ ) | k ) . collect ( ) } ) . to_boxed ( ) }
Recursively expands PathGlobs into PathStats while applying excludes.
Recursively expands PathGlobs into PathStats while applying excludes .
&self
path_globs
PathGlobs
&self
path_globs
PathGlobs