pub fn determine_root(&self, options: &Options) -> CargoResult<&PackageId> {
        if let Some(ref root_name) = options.flag_root {
            if let Ok(workspace_root) = self.workspace.current() {
                if root_name == workspace_root.name().as_str() {
                    Ok(workspace_root.package_id())
                } else {
                    for direct_dep in self.pkg_deps[workspace_root.package_id()].keys() {
                        if self.pkgs[direct_dep].name().as_str() == root_name {
                            return Ok(direct_dep);
                        }
                    }
                    return Err(err_msg(
                        "Root is neither the workspace root nor a direct dependency",
                    ));
                }
            } else {
                Err(err_msg(
                    "--root is not allowed when running against a virtual manifest",
                ))
            }
        } else {
            Ok(self.workspace.current()?.package_id())
        }
    }
/// Determine root package based on current workspace and CLI options
Determine root package based on current workspace and CLI options
Determine root package based on current workspace and CLI options
pub fn determine_root(&self, options: &Options) -> CargoResult<&PackageId> {
        if let Some(ref root_name) = options.flag_root {
            if let Ok(workspace_root) = self.workspace.current() {
                if root_name == workspace_root.name().as_str() {
                    Ok(workspace_root.package_id())
                } else {
                    for direct_dep in self.pkg_deps[workspace_root.package_id()].keys() {
                        if self.pkgs[direct_dep].name().as_str() == root_name {
                            return Ok(direct_dep);
                        }
                    }
                    return Err(err_msg(
                        "Root is neither the workspace root nor a direct dependency",
                    ));
                }
            } else {
                Err(err_msg(
                    "--root is not allowed when running against a virtual manifest",
                ))
            }
        } else {
            Ok(self.workspace.current()?.package_id())
        }
    }
pub fn determine_root ( & self , options : & Options ) -> CargoResult < & PackageId > { if let Some ( ref root_name ) = options . flag_root { if let Ok ( workspace_root ) = self . workspace . current ( ) { if root_name == workspace_root . name ( ) . as_str ( ) { Ok ( workspace_root . package_id ( ) ) } else { for direct_dep in self . pkg_deps [ workspace_root . package_id ( ) ] . keys ( ) { if self . pkgs [ direct_dep ] . name ( ) . as_str ( ) == root_name { return Ok ( direct_dep ) ; } } return Err ( err_msg ( " " , ) ) ; } } else { Err ( err_msg ( " " , ) ) } } else { Ok ( self . workspace . current ( ) ? . package_id ( ) ) } }
Determine root package based on current workspace and CLI options
Determine root package based on current workspace and CLI options
&self
options
&Options