Struct cargo::core::compiler::Unit

source ·
pub struct Unit {
    inner: Rc<UnitInner>,
}
Expand description

All information needed to define a unit.

A unit is an object that has enough information so that cargo knows how to build it. For example, if your package has dependencies, then every dependency will be built as a library unit. If your package is a library, then it will be built as a library unit as well, or if it is a binary with main.rs, then a binary will be output. There are also separate unit types for testing and checking, amongst others.

The unit also holds information about all possible metadata about the package in pkg.

A unit needs to know extra information in addition to the type and root source file. For example, it needs to know the target architecture (OS, chip arch etc.) and it needs to know whether you want a debug or release build. There is enough information in this struct to figure all that out.

Fields§

§inner: Rc<UnitInner>

Implementations§

Methods from Deref<Target = UnitInner>§

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
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
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: 8 bytes