pub struct Compilation<'cfg> {
    pub tests: Vec<UnitOutput>,
    pub binaries: Vec<UnitOutput>,
    pub cdylibs: Vec<UnitOutput>,
    pub root_crate_names: Vec<String>,
    pub native_dirs: BTreeSet<PathBuf>,
    pub root_output: HashMap<CompileKind, PathBuf>,
    pub deps_output: HashMap<CompileKind, PathBuf>,
    pub extra_env: HashMap<Metadata, Vec<(String, String)>>,
    pub to_doc_test: Vec<Doctest>,
    pub host: String,
    /* private fields */
}
Expand description

A structure returning the result of a compilation.

Fields§

§tests: Vec<UnitOutput>

An array of all tests created during this compilation.

§binaries: Vec<UnitOutput>

An array of all binaries created.

§cdylibs: Vec<UnitOutput>

An array of all cdylibs created.

§root_crate_names: Vec<String>

The crate names of the root units specified on the command-line.

§native_dirs: BTreeSet<PathBuf>

All directories for the output of native build commands.

This is currently used to drive some entries which are added to the LD_LIBRARY_PATH as appropriate.

The order should be deterministic.

§root_output: HashMap<CompileKind, PathBuf>

Root output directory (for the local package’s artifacts)

§deps_output: HashMap<CompileKind, PathBuf>

Output directory for rust dependencies. May be for the host or for a specific target.

§extra_env: HashMap<Metadata, Vec<(String, String)>>

Extra environment variables that were passed to compilations and should be passed to future invocations of programs.

The key is the build script metadata for uniquely identifying the RunCustomBuild unit that generated these env vars.

§to_doc_test: Vec<Doctest>

Libraries to test with rustdoc.

§host: String

The target host triple.

Implementations§

source§

impl<'cfg> Compilation<'cfg>

source

pub fn new<'a>(bcx: &BuildContext<'a, 'cfg>) -> CargoResult<Compilation<'cfg>>

source

pub fn rustc_process( &self, unit: &Unit, is_primary: bool, is_workspace: bool ) -> CargoResult<ProcessBuilder>

Returns a ProcessBuilder for running rustc.

is_primary is true if this is a “primary package”, which means it was selected by the user on the command-line (such as with a -p flag), see crate::core::compiler::Context::primary_packages.

is_workspace is true if this is a workspace member.

source

pub fn rustdoc_process( &self, unit: &Unit, script_meta: Option<Metadata> ) -> CargoResult<ProcessBuilder>

Returns a ProcessBuilder for running rustdoc.

source

pub fn host_process<T: AsRef<OsStr>>( &self, cmd: T, pkg: &Package ) -> CargoResult<ProcessBuilder>

Returns a ProcessBuilder appropriate for running a process for the host platform.

This is currently only used for running build scripts. If you use this for anything else, please be extra careful on how environment variables are set!

source

pub fn target_runner( &self, kind: CompileKind ) -> Option<&(PathBuf, Vec<String>)>

source

pub fn target_linker(&self, kind: CompileKind) -> Option<PathBuf>

Gets the user-specified linker for a particular host or target.

source

pub fn target_process<T: AsRef<OsStr>>( &self, cmd: T, kind: CompileKind, pkg: &Package, script_meta: Option<Metadata> ) -> CargoResult<ProcessBuilder>

Returns a ProcessBuilder appropriate for running a process for the target platform. This is typically used for cargo run and cargo test.

script_meta is the metadata for the RunCustomBuild unit that this unit used for its build script. Use None if the package did not have a build script.

Auto Trait Implementations§

§

impl<'cfg> Freeze for Compilation<'cfg>

§

impl<'cfg> !RefUnwindSafe for Compilation<'cfg>

§

impl<'cfg> !Send for Compilation<'cfg>

§

impl<'cfg> !Sync for Compilation<'cfg>

§

impl<'cfg> Unpin for Compilation<'cfg>

§

impl<'cfg> !UnwindSafe for Compilation<'cfg>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more