Struct guppy::graph::cargo::CargoSet[][src]

pub struct CargoSet<'g> { /* fields omitted */ }

A set of packages and features, as would be built by Cargo.

Cargo implements a set of algorithms to figure out which packages or features are built in a given situation. guppy implements those algorithms.

Implementations

impl<'g> CargoSet<'g>[src]

pub fn new(
    initials: FeatureSet<'g>,
    features_only: FeatureSet<'g>,
    opts: &CargoOptions<'_>
) -> Result<Self, Error>
[src]

Simulates a Cargo build of this feature set, with the given options.

The feature sets are expected to be entirely within the workspace. Its behavior outside the workspace isn't defined and may be surprising.

CargoSet::new takes two FeatureSet instances:

  • initials, from which dependencies are followed to build the CargoSet.
  • features_only, which are additional inputs that are only used for feature unification. This may be used to simulate, e.g. cargo build --package foo --package bar, when you only care about the results of foo but specifying bar influences the build.

Note that even if a package is in features_only, it may be included in the final build set through other means (for example, if it is also in initials or it is a dependency of one of them).

In many cases features_only is empty -- in that case you may wish to use FeatureSet::into_cargo_set(), and it may be more convenient to use that if the code is written in a "fluent" style.

pub fn feature_graph(&self) -> &FeatureGraph<'g>[src]

Returns the feature graph for this CargoSet instance.

pub fn package_graph(&self) -> &'g PackageGraph[src]

Returns the package graph for this CargoSet instance.

pub fn initials(&self) -> &FeatureSet<'g>[src]

Returns the initial packages and features from which the CargoSet instance was constructed.

pub fn features_only(&self) -> &FeatureSet<'g>[src]

Returns the packages and features that took part in feature unification but were not considered part of the final result.

For more about features_only and how it influences the build, see the documentation for CargoSet::new.

pub fn target_features(&self) -> &FeatureSet<'g>[src]

Returns the feature set enabled on the target platform.

This represents the packages and features that are included as code in the final build artifacts. This is relevant for both cross-compilation and auditing.

pub fn host_features(&self) -> &FeatureSet<'g>[src]

Returns the feature set enabled on the host platform.

This represents the packages and features that influence the final build artifacts, but whose code is generally not directly included.

This includes all procedural macros, including those specified in the initial query.

pub fn platform_features(
    &self,
    build_platform: BuildPlatform
) -> &FeatureSet<'g>
[src]

Returns the feature set enabled on the specified build platform.

pub fn all_features(&self) -> [(BuildPlatform, &FeatureSet<'g>); 2][src]

Returns the feature sets across the target and host build platforms.

pub fn target_direct_deps(&self) -> &PackageSet<'g>[src]

Returns the set of workspace and direct dependency packages on the target platform.

The packages in this set are a subset of the packages in target_features.

pub fn host_direct_deps(&self) -> &PackageSet<'g>[src]

Returns the set of workspace and direct dependency packages on the host platform.

The packages in this set are a subset of the packages in host_features.

pub fn platform_direct_deps(
    &self,
    build_platform: BuildPlatform
) -> &PackageSet<'g>
[src]

Returns the set of workspace and direct dependency packages on the specified build platform.

pub fn all_direct_deps(&self) -> [(BuildPlatform, &PackageSet<'g>); 2][src]

Returns the set of workspace and direct dependency packages across the target and host build platforms.

Returns PackageLink instances for procedural macro dependencies from target packages.

Procedural macros straddle the line between target and host: they're built for the host but generate code that is compiled for the target platform.

Notes

Procedural macro packages will be included in the host feature set.

The returned iterator will include proc macros that are depended on normally or in dev builds from initials (if include_dev is set), but not the ones in the [build-dependencies] section.

Returns PackageLink instances for build dependencies from target packages.

Notes

For each link, the from is built on the target while the to is built on the host. It is possible (though rare) that a build dependency is also included as a normal dependency, or as a dev dependency in which case it will also be built on the target.

The returned iterators will not include build dependencies of host packages -- those are also built on the host.

impl<'g> CargoSet<'g>[src]

pub fn to_summary(&self, opts: &CargoOptions<'_>) -> Result<Summary, Error>[src]

Creates a build summary with the given options.

Requires the summaries feature to be enabled.

Trait Implementations

impl<'g> Clone for CargoSet<'g>[src]

impl<'g> Debug for CargoSet<'g>[src]

Auto Trait Implementations

impl<'g> RefUnwindSafe for CargoSet<'g>[src]

impl<'g> Send for CargoSet<'g>[src]

impl<'g> Sync for CargoSet<'g>[src]

impl<'g> Unpin for CargoSet<'g>[src]

impl<'g> UnwindSafe for CargoSet<'g>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> SafeBorrow<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,