Skip to main content

BuildContext

Struct BuildContext 

Source
pub struct BuildContext<'a, 'cfg: 'a> {
Show 13 fields pub ws: &'a Workspace<'cfg>, pub config: &'cfg Config, pub resolve: &'a Resolve, pub profiles: &'a Profiles, pub build_config: &'a BuildConfig, pub extra_compiler_args: HashMap<Unit<'a>, Vec<String>>, pub packages: &'a PackageSet<'cfg>, pub rustc: Rustc, pub host_config: TargetConfig, pub target_config: TargetConfig, pub target_info: TargetInfo, pub host_info: TargetInfo, pub incremental_env: Option<bool>,
}
Expand description

The build context, containing all information about a build task

Fields§

§ws: &'a Workspace<'cfg>

The workspace the build is for

§config: &'cfg Config

The cargo configuration

§resolve: &'a Resolve

The dependency graph for our build

§profiles: &'a Profiles§build_config: &'a BuildConfig§extra_compiler_args: HashMap<Unit<'a>, Vec<String>>

Extra compiler args for either rustc or rustdoc.

§packages: &'a PackageSet<'cfg>§rustc: Rustc

Information about the compiler

§host_config: TargetConfig

Build information for the host arch

§target_config: TargetConfig

Build information for the target

§target_info: TargetInfo§host_info: TargetInfo§incremental_env: Option<bool>

Implementations§

Source§

impl<'a, 'cfg> BuildContext<'a, 'cfg>

Source

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

Source

pub fn extern_crate_name( &self, unit: &Unit<'a>, dep: &Unit<'a>, ) -> CargoResult<String>

Source

pub fn dep_platform_activated(&self, dep: &Dependency, kind: Kind) -> bool

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

Source

pub fn linker(&self, kind: Kind) -> Option<&Path>

Get the user-specified linker for a particular host or target

Source

pub fn ar(&self, kind: Kind) -> Option<&Path>

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

Source

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

Get the list of cfg printed out from the compiler for the specified kind

Source

pub fn host_triple(&self) -> &str

The host arch triple

e.g. x86_64-unknown-linux-gnu, would be

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

pub fn target_triple(&self) -> &str

Source

pub fn jobs(&self) -> u32

Number of jobs specified for this build

Source

pub fn rustflags_args(&self, unit: &Unit<'_>) -> CargoResult<Vec<String>>

Source

pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> CargoResult<Vec<String>>

Source

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

Source

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

Auto Trait Implementations§

§

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

§

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> !UnwindSafe for BuildContext<'a, 'cfg>

§

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

§

impl<'a, 'cfg> UnsafeUnpin for BuildContext<'a, '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, 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.
Source§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.