pub struct CompilationFiles<'a, 'gctx> {
    pub(super) host: Layout,
    pub(super) target: HashMap<CompileTarget, Layout>,
    export_dir: Option<PathBuf>,
    roots: Vec<Unit>,
    ws: &'a Workspace<'gctx>,
    metas: HashMap<Unit, MetaInfo>,
    outputs: HashMap<Unit, LazyCell<Arc<Vec<OutputFile>>>>,
}
Expand description

Collection of information about the files emitted by the compiler, and the output directory structure.

Fields§

§host: Layout

The target directory layout for the host (and target if it is the same as host).

§target: HashMap<CompileTarget, Layout>

The target directory layout for the target (if different from then host).

§export_dir: Option<PathBuf>

Additional directory to include a copy of the outputs.

§roots: Vec<Unit>

The root targets requested by the user on the command line (does not include dependencies).

§ws: &'a Workspace<'gctx>§metas: HashMap<Unit, MetaInfo>

Metadata hash to use for each unit.

§outputs: HashMap<Unit, LazyCell<Arc<Vec<OutputFile>>>>

For each Unit, a list all files produced.

Implementations§

source§

impl<'a, 'gctx: 'a> CompilationFiles<'a, 'gctx>

source

pub(super) fn new( build_runner: &BuildRunner<'a, 'gctx>, host: Layout, target: HashMap<CompileTarget, Layout> ) -> CompilationFiles<'a, 'gctx>

source

pub fn layout(&self, kind: CompileKind) -> &Layout

Returns the appropriate directory layout for either a plugin or not.

source

pub fn metadata(&self, unit: &Unit) -> Metadata

Gets the metadata for the given unit.

See Metadata and fingerprint module for more.

source

pub fn use_extra_filename(&self, unit: &Unit) -> bool

Returns whether or not -C extra-filename is used to extend the output filenames to make them unique.

source

pub fn target_short_hash(&self, unit: &Unit) -> String

Gets the short hash based only on the PackageId. Used for the metadata when metadata returns None.

source

pub fn out_dir(&self, unit: &Unit) -> PathBuf

Returns the directory where the artifacts for the given unit are initially created.

source

pub fn export_dir(&self) -> Option<PathBuf>

Additional export directory from --out-dir.

source

fn pkg_dir(&self, unit: &Unit) -> String

Directory name to use for a package in the form NAME-HASH.

Note that some units may share the same directory, so care should be taken in those cases!

source

pub fn host_dest(&self) -> &Path

Returns the final artifact path for the host (/…/target/debug)

source

pub fn host_root(&self) -> &Path

Returns the root of the build output tree for the host (/…/target)

source

pub fn host_deps(&self) -> &Path

Returns the host deps directory path.

source

pub fn deps_dir(&self, unit: &Unit) -> &Path

Returns the directories where Rust crate dependencies are found for the specified unit.

source

pub fn fingerprint_dir(&self, unit: &Unit) -> PathBuf

Directory where the fingerprint for the given unit should go.

source

pub fn fingerprint_file_path(&self, unit: &Unit, prefix: &str) -> PathBuf

Returns the path for a file in the fingerprint directory.

The “prefix” should be something to distinguish the file from other files in the fingerprint directory.

source

pub fn message_cache_path(&self, unit: &Unit) -> PathBuf

Path where compiler output is cached.

source

pub fn build_script_dir(&self, unit: &Unit) -> PathBuf

Returns the directory where a compiled build script is stored. /path/to/target/{debug,release}/build/PKG-HASH

source

fn artifact_dir(&self, unit: &Unit) -> PathBuf

Returns the directory for compiled artifacts files. /path/to/target/{debug,release}/deps/artifact/KIND/PKG-HASH

source

pub fn build_script_run_dir(&self, unit: &Unit) -> PathBuf

Returns the directory where information about running a build script is stored. /path/to/target/{debug,release}/build/PKG-HASH

source

pub fn build_script_out_dir(&self, unit: &Unit) -> PathBuf

Returns the “OUT_DIR” directory for running a build script. /path/to/target/{debug,release}/build/PKG-HASH/out

Returns the path to the executable binary for the given bin target.

This should only to be used when a Unit is not available.

source

pub(super) fn outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx> ) -> CargoResult<Arc<Vec<OutputFile>>>

Returns the filenames that the given unit will generate.

Note: It is not guaranteed that all of the files will be generated.

source

fn uplift_to( &self, unit: &Unit, file_type: &FileType, from_path: &Path ) -> Option<PathBuf>

Returns the path where the output for the given unit and FileType should be uplifted to.

Returns None if the unit shouldn’t be uplifted (for example, a dependent rlib).

source

fn calc_outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx> ) -> CargoResult<Arc<Vec<OutputFile>>>

Calculates the filenames that the given unit will generate. Should use CompilationFiles::outputs instead as it caches the result of this function.

source

fn calc_outputs_rustc( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx> ) -> CargoResult<Vec<OutputFile>>

Computes the actual, full pathnames for all the files generated by rustc.

The OutputFile also contains the paths where those files should be “uplifted” to.

Auto Trait Implementations§

§

impl<'a, 'gctx> Freeze for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !RefUnwindSafe for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !Send for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !Sync for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> Unpin for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !UnwindSafe for CompilationFiles<'a, 'gctx>

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.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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: 472 bytes