Struct hakari::HakariBuilder[][src]

pub struct HakariBuilder<'g> { /* fields omitted */ }
Expand description

Configures and constructs Hakari instances.

This struct provides a number of options that determine how Hakari instances are generated.

Implementations

Returns the set of operations that need to be performed to add the workspace-hack dependency to the given set of workspace crates.

Also includes remove operations for the workspace-hack dependency from excluded crates.

Returns None if the hakari package wasn’t specified at construction time.

Requires the cli-support feature to be enabled.

Returns the set of operations that need to be performed to add the workspace-hack dependency to the given set of workspace crates.

Returns None if the hakari package wasn’t specified at construction time.

Requires the cli-support feature to be enabled.

Returns the set of operations that need to be performed to remove the workspace-hack dependency from the given set of workspace crates.

Returns None if the hakari package wasn’t specified at construction time.

Requires the cli-support feature to be enabled.

Constructs a HakariBuilder from a PackageGraph and a serialized summary.

Requires the cli-support feature to be enabled.

Returns an error if the summary references a package that’s not present, or if there was some other issue while creating a HakariBuilder from the summary.

Creates a new HakariBuilder instance from a PackageGraph.

The Hakari package itself is usually present in the workspace. If so, specify its package ID, otherwise pass in None.

Returns an error if a Hakari package ID is specified but it isn’t known to the graph, or isn’t in the workspace.

Returns the PackageGraph used to construct this Hakari instance.

Returns the Hakari package, or None if it wasn’t passed into new.

Reads the existing TOML file for the Hakari package from disk, returning a HakariCargoToml.

This can be used with Hakari::to_toml_string to manage the contents of the Hakari package’s TOML file on disk.

Returns an error if there was an issue reading the TOML file from disk, or None if this builder was created without a Hakari package.

Sets a list of platforms for hakari to use.

By default, hakari unifies features that are always enabled across all platforms. If builds are commonly performed on a few platforms, hakari can output platform-specific instructions for those builds.

This currently supports target triples only, without further customization around target features or flags. In the future, this may support cfg() expressions using an SMT solver.

Call set_platforms with an empty list to reset to default behavior.

Returns an error if a platform wasn’t known to target_spec, the library hakari uses to resolve platforms.

Returns the platforms set through set_platforms, or an empty list if no platforms are set.

Sets the Cargo resolver version.

By default, HakariBuilder uses version 2 of the Cargo resolver. For more about Cargo resolvers, see the documentation for CargoResolverVersion.

Returns the current Cargo resolver version.

Pretends that the provided packages don’t exist during graph traversals.

Users may wish to not consider certain packages while figuring out the unified feature set. Setting this option prevents those packages from being considered.

Practically, this means that:

  • If a workspace package is specified, Cargo build simulations for it will not be run.
  • If a third-party package is specified, it will not be present in the output, nor will any transitive dependencies or features enabled by it that aren’t enabled any other way. In other words, any packages excluded during traversal are also excluded from the final output.

Returns an error if any package IDs specified aren’t known to the graph.

Returns the packages currently excluded during graph traversals.

Also returns the Hakari package if specified. This is because the Hakari package is treated as excluded while performing unification.

Returns true if a package ID is currently excluded during traversal.

Also returns true for the Hakari package if specified. This is because the Hakari package is treated as excluded by the algorithm.

Returns an error if this package ID isn’t known to the underlying graph.

Adds packages to be removed from the final output.

Unlike traversal_excludes, these packages are considered during traversals, but removed at the end.

Returns an error if any package IDs specified aren’t known to the graph.

Returns the packages to be removed from the final output.

Returns true if a package ID is currently excluded from the final output.

Returns an error if this package ID isn’t known to the underlying graph.

Returns true if a package ID is excluded from either the traversal or the final output.

Also returns true for the Hakari package if specified. This is because the Hakari package is treated as excluded by the algorithm.

Returns an error if this package ID isn’t known to the underlying graph.

Add alternate registries by (name, URL) pairs.

This is a temporary workaround until Cargo issue #9052 is resolved.

Whether and how to unify feature sets across target and host platforms.

This is an advanced feature that most users don’t need to set. For more information about this option, see the documentation for UnifyTargetHost.

Returns the current value of unify_target_host.

Whether to unify feature sets for all dependencies.

By default, Hakari only produces output for dependencies that are built with more than one feature set. If set to true, Hakari will produce outputs for all dependencies, including those that don’t need to be unified.

This is rarely needed in production, and is most useful for testing and debugging scenarios.

Returns the current value of output_single_feature.

Computes the Hakari for this builder.

Helpers for property testing

The methods in this section allow random instances of a HakariBuilder to be generated, for use in property-based testing scenarios.

Requires the proptest1 feature to be enabled.

Returns a Strategy that generates random HakariBuilder instances based on this graph.

Requires the proptest1 feature to be enabled.

Panics

Panics if:

  • there are no packages in this PackageGraph, or
  • hakari_id is specified but it isn’t known to the graph, or isn’t in the workspace.

Converts this HakariBuilder to a serializable summary.

Requires the cli-support feature to be enabled.

Returns an error if there are any custom platforms. Serializing custom platforms is currently unsupported.

Verify that hakari worked properly.

Returns Ok(()) if only one version of every third-party dependency was built, or a list of errors if at least one third-party dependency had more than one version built.

For more about how this works, see the documentation for the verify module.

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.