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

pub struct BuildContext<'a, 'cfg> {
    pub ws: &'a Workspace<'cfg>,
    pub config: &'cfg Config,
    pub profiles: &'a Profiles,
    pub build_config: &'a BuildConfig,
    pub extra_compiler_args: HashMap<Unit<'a>, Vec<String>>,
    pub packages: &'a PackageSet<'cfg>,
    pub units: &'a UnitInterner<'a>,
    pub rustc: Rustc,
    // some fields omitted
}

The build context, containing all information about a build task.

It is intended that this is mostly static information. Stuff that mutates during the build can be found in the parent Context. (I say mostly, because this has internal caching, but nothing that should be observable or require &mut.)

Fields

ws: &'a Workspace<'cfg>

The workspace the build is for.

config: &'cfg Config

The cargo configuration.

profiles: &'a Profilesbuild_config: &'a BuildConfigextra_compiler_args: HashMap<Unit<'a>, Vec<String>>

Extra compiler args for either rustc or rustdoc.

packages: &'a PackageSet<'cfg>units: &'a UnitInterner<'a>

Source of interning new units as they’re created.

rustc: Rustc

Information about the compiler that we’ve detected on the local system.

Implementations

impl<'a, 'cfg> BuildContext<'a, 'cfg>[src]

pub fn new(
    ws: &'a Workspace<'cfg>,
    packages: &'a PackageSet<'cfg>,
    config: &'cfg Config,
    build_config: &'a BuildConfig,
    profiles: &'a Profiles,
    units: &'a UnitInterner<'a>,
    extra_compiler_args: HashMap<Unit<'a>, Vec<String>>
) -> CargoResult<BuildContext<'a, 'cfg>>
[src]

pub fn dep_platform_activated(
    &self,
    dep: &Dependency,
    kind: CompileKind
) -> bool
[src]

Whether a dependency should be compiled for the host or target platform, specified by CompileKind.

pub fn linker(&self, kind: CompileKind) -> Option<&Path>[src]

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

pub fn ar(&self, kind: CompileKind) -> Option<&Path>[src]

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

pub fn cfg(&self, kind: CompileKind) -> &[Cfg][src]

Gets the list of cfgs printed out from the compiler for the specified kind.

pub fn host_triple(&self) -> InternedString[src]

Gets the host architecture triple.

For example, x86_64-unknown-linux-gnu, would be

  • machine: x86_64,
  • hardware-platform: unknown,
  • operating system: linux-gnu.

pub fn target_config(&self, kind: CompileKind) -> &TargetConfig[src]

Gets the target configuration for a particular host or target.

pub fn jobs(&self) -> u32[src]

Gets the number of jobs specified for this build.

pub fn rustflags_args(&self, unit: &Unit<'_>) -> &[String][src]

pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> &[String][src]

pub fn show_warnings(&self, pkg: PackageId) -> bool[src]

pub fn info(&self, kind: CompileKind) -> &TargetInfo[src]

pub fn extra_args_for(&self, unit: &Unit<'a>) -> Option<&Vec<String>>[src]

pub fn script_override(
    &self,
    lib_name: &str,
    kind: CompileKind
) -> Option<&BuildOutput>
[src]

If a build script is overridden, this returns the BuildOutput to use.

lib_name is the links library name and kind is whether it is for Host or Target.

Auto Trait Implementations

impl<'a, 'cfg> !RefUnwindSafe for BuildContext<'a, 'cfg>

impl<'a, 'cfg> !Send for BuildContext<'a, 'cfg>

impl<'a, 'cfg> !Sync for BuildContext<'a, 'cfg>

impl<'a, 'cfg> Unpin for BuildContext<'a, 'cfg> where
    'cfg: 'a, 

impl<'a, 'cfg> !UnwindSafe for BuildContext<'a, 'cfg>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]