pub fn materialize_directory(
    &self,
    destination: PathBuf,
    digest: Digest,
  ) -> BoxFuture<(), String> {
    try_future!(super::safe_create_dir_all(&destination));
    let store = self.clone();
    self
      .load_directory(digest)
      .and_then(move |directory_opt| {
        directory_opt.ok_or_else(|| format!("Directory with digest {:?} not found", digest))
      })
      .and_then(move |directory| {
        let file_futures = directory
          .get_files()
          .iter()
          .map(|file_node| {
            let store = store.clone();
            let path = destination.join(file_node.get_name());
            let digest = try_future!(file_node.get_digest().into());
            store.materialize_file(path, digest, file_node.is_executable)
          })
          .collect::<Vec<_>>();
        let directory_futures = directory
          .get_directories()
          .iter()
          .map(|directory_node| {
            let store = store.clone();
            let path = destination.join(directory_node.get_name());
            let digest = try_future!(directory_node.get_digest().into());
            store.materialize_directory(path, digest)
          })
          .collect::<Vec<_>>();
        future::join_all(file_futures)
          .join(future::join_all(directory_futures))
          .map(|_| ())
      })
      .to_boxed()
  }
///
/// Lays out the directory and all of its contents (files and directories) on disk so that a
/// process which uses the directory structure can run.
///
Lays out the directory and all of its contents (files and directories) on disk so that a
process which uses the directory structure can run.
Lays out the directory and all of its contents ( files and directories ) on disk so that a process which uses the directory structure can run .
pub fn materialize_directory(
    &self,
    destination: PathBuf,
    digest: Digest,
  ) -> BoxFuture<(), String> {
    try_future!(super::safe_create_dir_all(&destination));
    let store = self.clone();
    self
      .load_directory(digest)
      .and_then(move |directory_opt| {
        directory_opt.ok_or_else(|| format!("Directory with digest {:?} not found", digest))
      })
      .and_then(move |directory| {
        let file_futures = directory
          .get_files()
          .iter()
          .map(|file_node| {
            let store = store.clone();
            let path = destination.join(file_node.get_name());
            let digest = try_future!(file_node.get_digest().into());
            store.materialize_file(path, digest, file_node.is_executable)
          })
          .collect::<Vec<_>>();
        let directory_futures = directory
          .get_directories()
          .iter()
          .map(|directory_node| {
            let store = store.clone();
            let path = destination.join(directory_node.get_name());
            let digest = try_future!(directory_node.get_digest().into());
            store.materialize_directory(path, digest)
          })
          .collect::<Vec<_>>();
        future::join_all(file_futures)
          .join(future::join_all(directory_futures))
          .map(|_| ())
      })
      .to_boxed()
  }
pub fn materialize_directory ( & self , destination : PathBuf , digest : Digest , ) -> BoxFuture < ( ) , String > { try_future ! ( super safe_create_dir_all ( destination ) ) ; let store = self . clone ( ) ; self . load_directory ( digest ) . and_then ( move | directory_opt | { directory_opt . ok_or_else ( | | format ! ( " " digest ) ) } ) . and_then ( move | directory | { let file_futures = directory . get_files ( ) . iter ( ) . map ( | file_node | { let store = store . clone ( ) ; let path = destination . join ( file_node . get_name ( ) ) ; let digest = try_future ! ( file_node get_digest ( ) into ( ) ) ; store . materialize_file ( path , digest , file_node . is_executable ) } ) . collect :: < Vec < _ > > ( ) ; let directory_futures = directory . get_directories ( ) . iter ( ) . map ( | directory_node | { let store = store . clone ( ) ; let path = destination . join ( directory_node . get_name ( ) ) ; let digest = try_future ! ( directory_node get_digest ( ) into ( ) ) ; store . materialize_directory ( path , digest ) } ) . collect :: < Vec < _ > > ( ) ; future :: join_all ( file_futures ) . join ( future :: join_all ( directory_futures ) ) . map ( | _ | ( ) ) } ) . to_boxed ( ) }
Lays out the directory and all of its contents (files and directories) on disk so that a
process which uses the directory structure can run.
Lays out the directory and all of its contents ( files and directories ) on disk so that a process which uses the directory structure can run .
&self
destination
PathBuf
digest
Digest
&self
destination
PathBuf
digest
Digest