pub struct FeatureGraph<'g> { /* private fields */ }
Expand description

A derived graph representing every feature of every package.

Constructed through PackageGraph::feature_graph.

Implementations

Returns any non-fatal warnings encountered while constructing the feature graph.

Returns the PackageGraph from which this feature graph was constructed.

Returns the total number of (package ID, feature) combinations in this graph.

Includes the “base” feature for each package.

Returns the number of links in this graph.

Returns true if this feature graph contains the specified feature.

Returns metadata for the given feature ID, or None if the feature wasn’t found.

Returns all known features for a package.

Returns an error if the package ID was unknown.

Returns true if this feature is included in a package’s build by default.

Returns an error if this feature ID is unknown.

Cycles

A cyclic dev-dependency may cause additional features to be turned on. This computation does not follow conditional links and will not return true for such additional features.

Returns true if feature_a depends (directly or indirectly) on feature_b.

In other words, this returns true if feature_b is a (possibly transitive) dependency of feature_a.

This also returns true if feature_a is the same as feature_b.

Note that this returns true if feature_a conditionally depends on feature_b.

Returns true if feature_a directly depends on feature_b.

In other words, this returns true if feature_a is a direct dependency of feature_b.

This returns false if feature_a is the same as feature_b.

Returns information about dependency cycles.

For more information, see the documentation for Cycles.

Helpers for property testing

The methods in this section allow a FeatureGraph to be used in property-based testing scenarios.

Currently, proptest 1 is supported if the proptest1 feature is enabled.

This is supported on crate feature proptest1 only.

Returns a Strategy that generates random feature IDs from this graph.

The IDs so chosen are uniformly random from the entire feature graph. In other words, a package with more optional features is more likely to be chosen.

Requires the proptest1 feature to be enabled.

Panics

Panics if there are no packages in the PackageGraph from which this FeatureGraph was derived.

This is supported on crate feature proptest1 only.

Returns a Strategy that generates random feature sets from this graph.

Queries

The methods in this section create queries over subsets of this feature graph. Use the methods here to analyze transitive dependencies.

Creates a new query over the entire workspace.

query_workspace will select all workspace packages (subject to the provided filter) and their transitive dependencies.

Creates a new query that returns transitive dependencies of the given feature IDs in the specified direction.

Returns an error if any feature IDs are unknown.

Creates a new query that returns transitive dependencies of the given feature IDs.

Returns an error if any feature IDs are unknown.

Creates a new query that returns transitive reverse dependencies of the given feature IDs.

Returns an error if any feature IDs are unknown.

Creates a new FeatureSet consisting of all members of this feature graph.

This will include features that aren’t depended on by any workspace packages.

In most situations, query_workspace().resolve() is preferred. Use resolve_all if you know you need parts of the graph that aren’t accessible from the workspace.

Creates a new, empty FeatureSet associated with this feature graph.

Creates a new FeatureSet consisting of the specified feature IDs.

Returns an error if any feature IDs are unknown.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.