pub struct FeatureResolver<'a, 'gctx> {
ws: &'a Workspace<'gctx>,
target_data: &'a mut RustcTargetData<'gctx>,
requested_targets: &'a [CompileKind],
resolve: &'a Resolve,
package_set: &'a PackageSet<'gctx>,
opts: FeatureOpts,
activated_features: HashMap<(PackageId, FeaturesFor), BTreeSet<InternedString>>,
activated_dependencies: HashMap<(PackageId, FeaturesFor), BTreeSet<InternedString>>,
processed_deps: HashSet<(PackageId, FeaturesFor)>,
track_for_host: bool,
deferred_weak_dependencies: HashMap<(PackageId, FeaturesFor, InternedString), HashSet<InternedString>>,
}Expand description
The new feature resolver that resolves your project.
For more information, please see the module-level documentation.
Fields§
§ws: &'a Workspace<'gctx>§target_data: &'a mut RustcTargetData<'gctx>§requested_targets: &'a [CompileKind]The platforms to build for, requested by the user.
resolve: &'a Resolve§package_set: &'a PackageSet<'gctx>§opts: FeatureOptsOptions that change how the feature resolver operates.
activated_features: HashMap<(PackageId, FeaturesFor), BTreeSet<InternedString>>Map of features activated for each package.
activated_dependencies: HashMap<(PackageId, FeaturesFor), BTreeSet<InternedString>>Map of optional dependencies activated for each package.
processed_deps: HashSet<(PackageId, FeaturesFor)>Keeps track of which packages have had its dependencies processed. Used to avoid cycles, and to speed up processing.
track_for_host: boolIf this is true, then a non-default feature_key needs to be tracked while
traversing the graph.
This is only here to avoid calling has_any_proc_macro when all feature
options are disabled (because has_any_proc_macro can trigger downloads).
This has to be separate from FeatureOpts::decouple_host_deps because
for_host tracking is also needed for itarget to work properly.
deferred_weak_dependencies: HashMap<(PackageId, FeaturesFor, InternedString), HashSet<InternedString>>dep_name?/feat_name features that will be activated if dep_name is
ever activated.
The key is the (package, for_host, dep_name) of the package whose
dependency will trigger the addition of new features. The value is the
set of features to activate.
Implementations§
Source§impl<'a, 'gctx> FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> FeatureResolver<'a, 'gctx>
Sourcepub fn resolve(
ws: &Workspace<'gctx>,
target_data: &'a mut RustcTargetData<'gctx>,
resolve: &Resolve,
package_set: &'a PackageSet<'gctx>,
cli_features: &CliFeatures,
specs: &[PackageIdSpec],
requested_targets: &[CompileKind],
opts: FeatureOpts,
) -> CargoResult<ResolvedFeatures>
pub fn resolve( ws: &Workspace<'gctx>, target_data: &'a mut RustcTargetData<'gctx>, resolve: &Resolve, package_set: &'a PackageSet<'gctx>, cli_features: &CliFeatures, specs: &[PackageIdSpec], requested_targets: &[CompileKind], opts: FeatureOpts, ) -> CargoResult<ResolvedFeatures>
Runs the resolution algorithm and returns a new ResolvedFeatures
with the result.
Sourcefn do_resolve(
&mut self,
specs: &[PackageIdSpec],
cli_features: &CliFeatures,
) -> CargoResult<()>
fn do_resolve( &mut self, specs: &[PackageIdSpec], cli_features: &CliFeatures, ) -> CargoResult<()>
Performs the process of resolving all features for the resolve graph.
Sourcefn activate_pkg(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
fvs: &[FeatureValue],
) -> CargoResult<()>
fn activate_pkg( &mut self, pkg_id: PackageId, fk: FeaturesFor, fvs: &[FeatureValue], ) -> CargoResult<()>
Activates FeatureValues on the given package.
This is the main entrance into the recursion of feature activation for a package.
Sourcefn activate_fv(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
fv: &FeatureValue,
) -> CargoResult<()>
fn activate_fv( &mut self, pkg_id: PackageId, fk: FeaturesFor, fv: &FeatureValue, ) -> CargoResult<()>
Activate a single FeatureValue for a package.
Sourcefn activate_rec(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
feature_to_enable: InternedString,
) -> CargoResult<()>
fn activate_rec( &mut self, pkg_id: PackageId, fk: FeaturesFor, feature_to_enable: InternedString, ) -> CargoResult<()>
Activate the given feature for the given package, and then recursively activate any other features that feature enables.
Sourcefn activate_dependency(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
dep_name: InternedString,
) -> CargoResult<()>
fn activate_dependency( &mut self, pkg_id: PackageId, fk: FeaturesFor, dep_name: InternedString, ) -> CargoResult<()>
Activate a dependency (dep:dep_name syntax).
Sourcefn activate_dep_feature(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
dep_name: InternedString,
dep_feature: InternedString,
weak: bool,
) -> CargoResult<()>
fn activate_dep_feature( &mut self, pkg_id: PackageId, fk: FeaturesFor, dep_name: InternedString, dep_feature: InternedString, weak: bool, ) -> CargoResult<()>
Activate a feature within a dependency (dep_name/feat_name syntax).
Sourcefn fvs_from_dependency(
&self,
dep_id: PackageId,
dep: &Dependency,
) -> Vec<FeatureValue>
fn fvs_from_dependency( &self, dep_id: PackageId, dep: &Dependency, ) -> Vec<FeatureValue>
Returns Vec of FeatureValues from a Dependency definition.
Sourcefn fvs_from_requested(
&self,
pkg_id: PackageId,
cli_features: &CliFeatures,
) -> Vec<FeatureValue>
fn fvs_from_requested( &self, pkg_id: PackageId, cli_features: &CliFeatures, ) -> Vec<FeatureValue>
Returns Vec of FeatureValues from a set of command-line features.
Sourcefn deps(
&mut self,
pkg_id: PackageId,
fk: FeaturesFor,
) -> CargoResult<Vec<(PackageId, Vec<(&'a Dependency, FeaturesFor)>)>>
fn deps( &mut self, pkg_id: PackageId, fk: FeaturesFor, ) -> CargoResult<Vec<(PackageId, Vec<(&'a Dependency, FeaturesFor)>)>>
Returns the dependencies for a package, filtering out inactive targets.
Sourcefn has_any_proc_macro(&self, package_id: PackageId) -> bool
fn has_any_proc_macro(&self, package_id: PackageId) -> bool
Whether the given package has any proc macro target, including proc-macro examples.
Sourcefn has_proc_macro_lib(&self, package_id: PackageId) -> bool
fn has_proc_macro_lib(&self, package_id: PackageId) -> bool
Whether the given package is a proc macro lib target.
This is useful for checking if a dependency is a proc macro, as it is not possible to depend on a non-lib target as a proc-macro.
Auto Trait Implementations§
impl<'a, 'gctx> Freeze for FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> !RefUnwindSafe for FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> !Send for FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> !Sync for FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> Unpin for FeatureResolver<'a, 'gctx>
impl<'a, 'gctx> !UnwindSafe for FeatureResolver<'a, 'gctx>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 248 bytes