Struct cargo::core::compiler::unit::UnitInner

source ·
pub struct UnitInner {
    pub pkg: Package,
    pub target: Target,
    pub profile: Profile,
    pub kind: CompileKind,
    pub mode: CompileMode,
    pub features: Vec<InternedString>,
    pub artifact: IsArtifact,
    pub is_std: bool,
    pub dep_hash: u64,
    pub artifact_target_for_features: Option<CompileTarget>,
}
Expand description

Internal fields of Unit which Unit will dereference to.

Fields§

§pkg: Package

Information about available targets, which files to include/exclude, etc. Basically stuff in Cargo.toml.

§target: Target

Information about the specific target to build, out of the possible targets in pkg. Not to be confused with target-triple (or target architecture …), the target arch for a build.

§profile: Profile

The profile contains information about how the build should be run, including debug level, etc.

§kind: CompileKind

Whether this compilation unit is for the host or target architecture.

For example, when cross compiling and using a custom build script, the build script needs to be compiled for the host architecture so the host rustc can use it (when compiling to the target architecture).

§mode: CompileMode

The “mode” this unit is being compiled for. See CompileMode for more details.

§features: Vec<InternedString>

The cfg features to enable for this unit. This must be sorted.

§artifact: IsArtifact§is_std: bool

Whether this is a standard library unit.

§dep_hash: u64

A hash of all dependencies of this unit.

This is used to keep the Unit unique in the situation where two otherwise identical units need to link to different dependencies. This can happen, for example, when there are shared dependencies that need to be built with different features between normal and build dependencies. See rebuild_unit_graph_shared for more on why this is done.

This value initially starts as 0, and then is filled in via a second-pass after all the unit dependencies have been computed.

§artifact_target_for_features: Option<CompileTarget>

This is used for target-dependent feature resolution and is copied from FeaturesFor::ArtifactDep, if the enum matches the variant.

Implementations§

Returns whether compilation of this unit requires all upstream artifacts to be available.

This effectively means that this unit is a synchronization point (if the return value is true) that all previously pipelined units need to finish in their entirety before this one is started.

Returns whether or not this is a “local” package.

A “local” package is one that the user can likely edit, or otherwise wants warnings, etc.

Returns whether or not warnings should be displayed for this unit.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. 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 ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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
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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 240 bytes