pub struct UnitFor { /* private fields */ }
Expand description

Flags used in creating Units to indicate the purpose for the target, and to ensure the target’s dependencies have the correct settings.

This means these are passed down from the root of the dependency tree to apply to most child dependencies.

Implementations

A unit for a normal target/dependency (i.e., not custom build, proc macro/plugin, or test/bench).

A unit for a custom build script or proc-macro or its dependencies.

The host_features parameter is whether or not this is for a build dependency or proc-macro (something that requires being built “on the host”). Build scripts for non-host units should use false because they want to use the features of the package they are running for.

A unit for a compiler plugin or their dependencies.

A unit for a test/bench target or their dependencies.

Note that config is taken here for unstable CLI features to detect whether panic=abort is supported for tests. Historical versions of rustc did not support this, but newer versions do with an unstable compiler flag.

This is a special case for unit tests of a proc-macro.

Proc-macro unit tests are forced to be run on the host.

Returns a new copy updated based on the target dependency.

This is where the magic happens that the host/host_features settings transition in a sticky fashion. As the dependency graph is being built, once those flags are set, they stay set for the duration of that portion of tree.

Returns true if this unit is for a build script or any of its dependencies, or a proc macro or any of its dependencies.

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

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

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.

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

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.