fn produce_targets(&self, package_root_path: &Path) -> Result<Vec<BuildableTarget>> {
    let mut targets = Vec::new();
    let package = self.crate_catalog_entry.package();
    for target in &package.targets {
      // Bazel uses / as a path delimiter, but / is not the path delimiter on all
      // operating systems (like Mac OS 9, or something people actually use like Windows).
      // Strip off the package root, decompose the path into parts and rejoin
      // them with '/'.
      let package_root_path_str = target
        .src_path
        .strip_prefix(package_root_path)
        .unwrap_or(&target.src_path)
        .components()
        .map(|c| c.as_os_str().to_str())
        .try_fold("".to_owned(), |res, v| Some(format!("{}/{}", res, v?)))
        .ok_or_else(|| {
          io::Error::new(
            io::ErrorKind::InvalidData,
            format!(
              "{:?} contains non UTF-8 characters and is not a legal path in Bazel",
              &target.src_path
            ),
          )
        })?
        .trim_start_matches('/')
        .to_owned();

      for kind in &target.kind {
        targets.push(BuildableTarget {
          name: target.name.clone(),
          path: package_root_path_str.clone(),
          kind: kind.clone(),
          edition: target.edition.clone(),
        });
      }
    }

    targets.sort();
    Ok(targets)
  }
/// Produces the complete set of build targets specified by this crate.
/// This function may access the file system. See #find_package_root_for_manifest for more
/// details.
Produces the complete set of build targets specified by this crate.
This function may access the file system. See #find_package_root_for_manifest for more
details.
Produces the complete set of build targets specified by this crate . This function may access the file system . See #find_package_root_for_manifest for more details .
fn produce_targets(&self, package_root_path: &Path) -> Result<Vec<BuildableTarget>> {
    let mut targets = Vec::new();
    let package = self.crate_catalog_entry.package();
    for target in &package.targets {
      // Bazel uses / as a path delimiter, but / is not the path delimiter on all
      // operating systems (like Mac OS 9, or something people actually use like Windows).
      // Strip off the package root, decompose the path into parts and rejoin
      // them with '/'.
      let package_root_path_str = target
        .src_path
        .strip_prefix(package_root_path)
        .unwrap_or(&target.src_path)
        .components()
        .map(|c| c.as_os_str().to_str())
        .try_fold("".to_owned(), |res, v| Some(format!("{}/{}", res, v?)))
        .ok_or_else(|| {
          io::Error::new(
            io::ErrorKind::InvalidData,
            format!(
              "{:?} contains non UTF-8 characters and is not a legal path in Bazel",
              &target.src_path
            ),
          )
        })?
        .trim_start_matches('/')
        .to_owned();
      for kind in &target.kind {
        targets.push(BuildableTarget {
          name: target.name.clone(),
          path: package_root_path_str.clone(),
          kind: kind.clone(),
          edition: target.edition.clone(),
        });
      }
    }
    targets.sort();
    Ok(targets)
  }
fn produce_targets ( & self , package_root_path : & Path ) -> Result < Vec < BuildableTarget > > { let mut targets = Vec :: new ( ) ; let package = self . crate_catalog_entry . package ( ) ; for target in & package . targets { // Bazel uses / as a path delimiter, but / is not the path delimiter on all // operating systems (like Mac OS 9, or something people actually use like Windows). // Strip off the package root, decompose the path into parts and rejoin // them with '/'. let package_root_path_str = target . src_path . strip_prefix ( package_root_path ) . unwrap_or ( & target . src_path ) . components ( ) . map ( | c | c . as_os_str ( ) . to_str ( ) ) . try_fold ( " " . to_owned ( ) , | res , v | Some ( format ! ( " " res v ) ) ) . ok_or_else ( | | { io :: Error :: new ( io :: ErrorKind :: InvalidData , format ! ( " " target src_path ) , ) } ) ? . trim_start_matches ( '/' ) . to_owned ( ) ; for kind in & target . kind { targets . push ( BuildableTarget { name : target . name . clone ( ) , path : package_root_path_str . clone ( ) , kind : kind . clone ( ) , edition : target . edition . clone ( ) , } ) ; } } targets . sort ( ) ; Ok ( targets ) }
Produces the complete set of build targets specified by this crate.
Produces the complete set of build targets specified by this crate .
&self
package_root_path
&Path
&self
package_root_path
&Path