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 ConfigThe cargo configuration
resolve: &'a ResolveThe 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: RustcInformation about the compiler
host_config: TargetConfigBuild information for the host arch
target_config: TargetConfigBuild information for the target
target_info: TargetInfo§host_info: TargetInfo§incremental_env: Option<bool>Implementations§
Source§impl<'a, 'cfg> BuildContext<'a, 'cfg>
impl<'a, 'cfg> BuildContext<'a, 'cfg>
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>>
pub fn extern_crate_name( &self, unit: &Unit<'a>, dep: &Unit<'a>, ) -> CargoResult<String>
Sourcepub fn dep_platform_activated(&self, dep: &Dependency, kind: Kind) -> bool
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.
Sourcepub fn linker(&self, kind: Kind) -> Option<&Path>
pub fn linker(&self, kind: Kind) -> Option<&Path>
Get the user-specified linker for a particular host or target
Sourcepub fn ar(&self, kind: Kind) -> Option<&Path>
pub fn ar(&self, kind: Kind) -> Option<&Path>
Get the user-specified ar program for a particular host or target
Sourcepub fn cfg(&self, kind: Kind) -> &[Cfg]
pub fn cfg(&self, kind: Kind) -> &[Cfg]
Get the list of cfg printed out from the compiler for the specified kind
Sourcepub fn host_triple(&self) -> &str
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
pub fn target_triple(&self) -> &str
pub fn rustflags_args(&self, unit: &Unit<'_>) -> CargoResult<Vec<String>>
pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> CargoResult<Vec<String>>
pub fn show_warnings(&self, pkg: PackageId) -> bool
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more