pub fn from_manifest(manifest_path: &Path, package_name: Option<&str>, output_path: Option<String>, target: Option<&str>, variant: Option<&str>, deb_version: Option<String>, listener: &dyn Listener) -> CDResult<Config> {
        let metadata = cargo_metadata(manifest_path)?;
        let available_package_names = || {
            metadata.packages.iter()
                .filter(|p| metadata.workspace_members.iter().any(|w| w == &p.id))
                .map(|p| p.name.as_str())
                .collect::<Vec<_>>().join(", ")
        };
        let root_package = if let Some(name) = package_name {
            metadata.packages.iter().find(|p| {
                p.name == name
            })
            .ok_or_else(|| CargoDebError::PackageNotFoundInWorkspace(name.into(), available_package_names()))
        } else {
            metadata.resolve.root.as_ref().and_then(|root_id| {
                metadata.packages.iter()
                    .find(|p| &p.id == root_id)
            })
            .ok_or_else(|| CargoDebError::NoRootFoundInWorkspace(available_package_names()))
        }?;
        let target_dir = Path::new(&metadata.target_directory);
        let manifest_path = Path::new(&root_package.manifest_path);
        let manifest_dir = manifest_path.parent().unwrap();
        let content = fs::read(&manifest_path)
            .map_err(|e| CargoDebError::IoFile("unable to read Cargo.toml", e, manifest_path.to_owned()))?;
        toml::from_slice::<Cargo>(&content)?.into_config(root_package, manifest_dir, output_path, target_dir, target, variant, deb_version, listener)
    }
/// Makes a new config from `Cargo.toml` in the current working directory.
///
/// `None` target means the host machine's architecture.
Makes a new config from `Cargo.toml` in the current working directory.
`None` target means the host machine's architecture.
Makes a new config from ` Cargo . toml ` in the current working directory . ` None ` target means the host machine ' s architecture .
pub fn from_manifest(manifest_path: &Path, package_name: Option<&str>, output_path: Option<String>, target: Option<&str>, variant: Option<&str>, deb_version: Option<String>, listener: &dyn Listener) -> CDResult<Config> {
        let metadata = cargo_metadata(manifest_path)?;
        let available_package_names = || {
            metadata.packages.iter()
                .filter(|p| metadata.workspace_members.iter().any(|w| w == &p.id))
                .map(|p| p.name.as_str())
                .collect::<Vec<_>>().join(", ")
        };
        let root_package = if let Some(name) = package_name {
            metadata.packages.iter().find(|p| {
                p.name == name
            })
            .ok_or_else(|| CargoDebError::PackageNotFoundInWorkspace(name.into(), available_package_names()))
        } else {
            metadata.resolve.root.as_ref().and_then(|root_id| {
                metadata.packages.iter()
                    .find(|p| &p.id == root_id)
            })
            .ok_or_else(|| CargoDebError::NoRootFoundInWorkspace(available_package_names()))
        }?;
        let target_dir = Path::new(&metadata.target_directory);
        let manifest_path = Path::new(&root_package.manifest_path);
        let manifest_dir = manifest_path.parent().unwrap();
        let content = fs::read(&manifest_path)
            .map_err(|e| CargoDebError::IoFile("unable to read Cargo.toml", e, manifest_path.to_owned()))?;
        toml::from_slice::<Cargo>(&content)?.into_config(root_package, manifest_dir, output_path, target_dir, target, variant, deb_version, listener)
    }
pub fn from_manifest ( manifest_path : & Path , package_name : Option < & str > , output_path : Option < String > , target : Option < & str > , variant : Option < & str > , deb_version : Option < String > , listener : & dyn Listener ) -> CDResult < Config > { let metadata = cargo_metadata ( manifest_path ) ? ; let available_package_names = | | { metadata . packages . iter ( ) . filter ( | p | metadata . workspace_members . iter ( ) . any ( | w | w == & p . id ) ) . map ( | p | p . name . as_str ( ) ) . collect :: < Vec < _ > > ( ) . join ( " " ) } ; let root_package = if let Some ( name ) = package_name { metadata . packages . iter ( ) . find ( | p | { p . name == name } ) . ok_or_else ( | | CargoDebError :: PackageNotFoundInWorkspace ( name . into ( ) , available_package_names ( ) ) ) } else { metadata . resolve . root . as_ref ( ) . and_then ( | root_id | { metadata . packages . iter ( ) . find ( | p | & p . id == root_id ) } ) . ok_or_else ( | | CargoDebError :: NoRootFoundInWorkspace ( available_package_names ( ) ) ) } ? ; let target_dir = Path :: new ( & metadata . target_directory ) ; let manifest_path = Path :: new ( & root_package . manifest_path ) ; let manifest_dir = manifest_path . parent ( ) . unwrap ( ) ; let content = fs :: read ( & manifest_path ) . map_err ( | e | CargoDebError :: IoFile ( " " , e , manifest_path . to_owned ( ) ) ) ? ; toml :: from_slice :: < Cargo > ( & content ) ? . into_config ( root_package , manifest_dir , output_path , target_dir , target , variant , deb_version , listener ) }
Makes a new config from `Cargo.toml` in the current working directory.
Makes a new config from ` Cargo . toml ` in the current working directory .
manifest_path
&Path
package_name
Option<&str>
output_path
Option<String>
target
Option<&str>
variant
Option<&str>
deb_version
Option<String>
listener
&dyn Listener
manifest_path
&Path
package_name
Option<&str>
output_path
Option<String>
target
Option<&str>
variant
Option<&str>
deb_version
Option<String>
listener
&dyn Listener