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.
Implementations§
Source§impl UnitFor
impl UnitFor
Sourcepub fn new_normal() -> UnitFor
pub fn new_normal() -> UnitFor
A unit for a normal target/dependency (i.e., not custom build, proc macro/plugin, or test/bench).
Sourcepub fn new_host(host_features: bool) -> UnitFor
pub fn new_host(host_features: bool) -> UnitFor
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.
Sourcepub fn new_compiler() -> UnitFor
pub fn new_compiler() -> UnitFor
A unit for a compiler plugin or their dependencies.
Sourcepub fn new_test(config: &Config) -> UnitFor
pub fn new_test(config: &Config) -> UnitFor
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.
Sourcepub fn with_for_host(self, for_host: bool) -> UnitFor
pub fn with_for_host(self, for_host: bool) -> UnitFor
Returns a new copy based on for_host setting.
When for_host is true, this clears panic_abort_ok in a sticky
fashion so that all its dependencies also have panic_abort_ok=false.
This’ll help ensure that once we start compiling for the host platform
(build scripts, plugins, proc macros, etc) we’ll share the same build
graph where everything is panic=unwind.
Sourcepub fn with_host_features(self, host_features: bool) -> UnitFor
pub fn with_host_features(self, host_features: bool) -> UnitFor
Returns a new copy updating it whether or not it should use features for build dependencies and proc-macros.
This is part of the machinery responsible for handling feature decoupling for build dependencies in the new feature resolver.
Sourcepub fn is_for_host(&self) -> bool
pub fn is_for_host(&self) -> bool
Returns true if this unit is for a build script or any of its
dependencies, or a proc macro or any of its dependencies.
pub fn is_for_host_features(&self) -> bool
Sourcepub fn all_values() -> &'static [UnitFor]
pub fn all_values() -> &'static [UnitFor]
All possible values, used by clean.