Enum hakari::UnifyTargetHost[][src]

#[non_exhaustive]
pub enum UnifyTargetHost {
    None,
    Auto,
    UnifyIfBoth,
    ReplicateTargetOnHost,
}
Expand description

Whether to unify feature sets for a given dependency across target and host platforms.

Consider a dependency that is built as both normally (on the target platform) and in a build script or proc macro. The normal dependency is considered to be built on the target platform, and is represented in the [dependencies] section in the generated Cargo.toml. The build dependency is built on the host platform, represented in the [build-dependencies] section.

Now consider that the target and host platforms need two different sets of features:

# feature set on target platform
[dependencies]
my-dep = { version = "1.0", features = ["a", "b"] }

# feature set on host platform
[build-dependencies]
my-dep = { version = "1.0", features = ["b", "c"] }

Should hakari unify the feature sets across the [dependencies] and [build-dependencies] feature sets?

Call HakariBuilder::set_unify_target_host to configure this option.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

None

Perform no unification across the target and host feature sets.

This is the most conservative option, but it means that some dependencies may be built with two different sets of features. In this mode, Hakari will likely be significantly less efficient.

Auto

Automatically choose between the UnifyIfBoth and the ReplicateTargetOnHost options:

  • If the workspace contains proc macros, or crates that are build dependencies of other crates, choose the ReplicateTargetAsHost strategy.
  • Otherwise, choose the UnifyIfBoth strategy.

This is the default behavior.

UnifyIfBoth

Perform unification across target and host feature sets, but only if a dependency is built on both the target and the host.

This is useful if cross-compilations are uncommon and one wishes to avoid the same package being built two different ways: once for the target and once for the host.

ReplicateTargetOnHost

Perform unification across target and host feature sets, and also replicate all target-only lines to the host.

This is most useful if some workspace packages are proc macros or build dependencies used by other packages.

Trait Implementations

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default. Read more

The type of Strategy used to generate values of type Self. Read more

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The default for UnifyTargetHost: automatically choose unification strategy based on the workspace.

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. 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

Compare self to key and return true if they are equal.

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)

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.