[][src]Struct cargo::core::compiler::Unit

pub struct Unit<'a> {
    pub pkg: &'a Package,
    pub target: &'a Target,
    pub profile: Profile,
    pub kind: Kind,
    pub mode: CompileMode,
}

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

pkg: &'a Package

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

target: &'a 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: Kind

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.

Methods

impl<'a> Unit<'a>[src]

pub fn buildkey(&self) -> String[src]

Trait Implementations

impl<'a> PartialOrd<Unit<'a>> for Unit<'a>[src]

impl<'a> Copy for Unit<'a>[src]

impl<'a> PartialEq<Unit<'a>> for Unit<'a>[src]

impl<'a> Clone for Unit<'a>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Ord for Unit<'a>[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<'a> Eq for Unit<'a>[src]

impl<'a> Debug for Unit<'a>[src]

impl<'a> Hash for Unit<'a>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

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

Auto Trait Implementations

impl<'a> !Send for Unit<'a>

impl<'a> !Sync for Unit<'a>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self