pub fn new<'a>(
        package_graph: &'g PackageGraph,
        paths: impl IntoIterator<Item = &'a Path>,
        feature_filter: impl FeatureFilter<'g>,
        cargo_opts: &CargoOptions<'_>,
    ) -> Result<Self, guppy::Error> {
        // For each workspace member, match the path to a package ID.
        let workspace = package_graph.workspace();
        let members = paths
            .into_iter()
            .map(|path| {
                Ok(workspace
                    .member_by_path(path)
                    .ok_or_else(|| {
                        // TODO: should have a custom error for this (move into guppy?)
                        guppy::Error::UnknownWorkspaceName(format!(
                            "unknown workspace member by path: {}",
                            path.display()
                        ))
                    })?
                    .id())
            })
            .collect::<Result<HashSet<_>, guppy::Error>>()?;
        let package_query = package_graph.query_forward(members.iter().copied())?;

        // Use the Cargo resolver to figure out which packages will be included.
        let build_set = package_graph
            .feature_graph()
            .query_packages(&package_query, feature_filter)
            .resolve_cargo(cargo_opts)?;
        let unified_set = build_set.host_features().union(build_set.target_features());

        Ok(Self {
            package_graph,
            members,
            build_set,
            unified_set,
        })
    }
/// Creates a new subset by simulating a Cargo build on the specified workspace paths, with
/// the given feature filter.
Creates a new subset by simulating a Cargo build on the specified workspace paths, with
the given feature filter.
Creates a new subset by simulating a Cargo build on the specified workspace paths with the given feature filter .
pub fn new<'a>(
        package_graph: &'g PackageGraph,
        paths: impl IntoIterator<Item = &'a Path>,
        feature_filter: impl FeatureFilter<'g>,
        cargo_opts: &CargoOptions<'_>,
    ) -> Result<Self, guppy::Error> {
        // For each workspace member, match the path to a package ID.
        let workspace = package_graph.workspace();
        let members = paths
            .into_iter()
            .map(|path| {
                Ok(workspace
                    .member_by_path(path)
                    .ok_or_else(|| {
                        // TODO: should have a custom error for this (move into guppy?)
                        guppy::Error::UnknownWorkspaceName(format!(
                            "unknown workspace member by path: {}",
                            path.display()
                        ))
                    })?
                    .id())
            })
            .collect::<Result<HashSet<_>, guppy::Error>>()?;
        let package_query = package_graph.query_forward(members.iter().copied())?;
        // Use the Cargo resolver to figure out which packages will be included.
        let build_set = package_graph
            .feature_graph()
            .query_packages(&package_query, feature_filter)
            .resolve_cargo(cargo_opts)?;
        let unified_set = build_set.host_features().union(build_set.target_features());
        Ok(Self {
            package_graph,
            members,
            build_set,
            unified_set,
        })
    }
pub fn new < ' a > ( package_graph : & ' g PackageGraph , paths : impl IntoIterator < Item = & ' a Path > , feature_filter : impl FeatureFilter < ' g > , cargo_opts : & CargoOptions < ' _ > , ) -> Result < Self , guppy :: Error > { // For each workspace member, match the path to a package ID. let workspace = package_graph . workspace ( ) ; let members = paths . into_iter ( ) . map ( | path | { Ok ( workspace . member_by_path ( path ) . ok_or_else ( | | { // TODO: should have a custom error for this (move into guppy?) guppy :: Error :: UnknownWorkspaceName ( format ! ( " " path display ( ) ) ) } ) ? . id ( ) ) } ) . collect :: < Result < HashSet < _ > , guppy :: Error > > ( ) ? ; let package_query = package_graph . query_forward ( members . iter ( ) . copied ( ) ) ? ; // Use the Cargo resolver to figure out which packages will be included. let build_set = package_graph . feature_graph ( ) . query_packages ( & package_query , feature_filter ) . resolve_cargo ( cargo_opts ) ? ; let unified_set = build_set . host_features ( ) . union ( build_set . target_features ( ) ) ; Ok ( Self { package_graph , members , build_set , unified_set , } ) }
Creates a new subset by simulating a Cargo build on the specified workspace paths, with
the given feature filter.
Creates a new subset by simulating a Cargo build on the specified workspace paths with the given feature filter .
package_graph
&'g PackageGraph
paths
impl IntoIterator<Item = &'a Path>
feature_filter
impl FeatureFilter<'g>
cargo_opts
&CargoOptions<'_>
package_graph
&'g PackageGraph
paths
impl IntoIterator<Item = &'a Path>
feature_filter
impl FeatureFilter<'g>
cargo_opts
&CargoOptions<'_>