pub struct BuildContext<'a, 'cfg> {
pub ws: &'a Workspace<'cfg>,
pub config: &'cfg Config,
pub profiles: Profiles,
pub build_config: &'a BuildConfig,
pub extra_compiler_args: HashMap<Unit, Vec<String>>,
pub packages: PackageSet<'cfg>,
pub target_data: RustcTargetData<'cfg>,
pub roots: Vec<Unit>,
pub unit_graph: UnitGraph,
pub all_kinds: HashSet<CompileKind>,
}
Expand description
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: Profiles
build_config: &'a BuildConfig
extra_compiler_args: HashMap<Unit, Vec<String>>
Extra compiler args for either rustc
or rustdoc
.
packages: PackageSet<'cfg>
Package downloader.
This holds ownership of the Package
objects.
target_data: RustcTargetData<'cfg>
Information about rustc and the target platform.
roots: Vec<Unit>
The root units of unit_graph
(units requested on the command-line).
unit_graph: UnitGraph
The dependency graph of units to compile.
all_kinds: HashSet<CompileKind>
The list of all kinds that are involved in this build
Implementations
sourceimpl<'a, 'cfg> BuildContext<'a, 'cfg>
impl<'a, 'cfg> BuildContext<'a, 'cfg>
pub fn new(
ws: &'a Workspace<'cfg>,
packages: PackageSet<'cfg>,
build_config: &'a BuildConfig,
profiles: Profiles,
extra_compiler_args: HashMap<Unit, Vec<String>>,
target_data: RustcTargetData<'cfg>,
roots: Vec<Unit>,
unit_graph: UnitGraph
) -> CargoResult<BuildContext<'a, 'cfg>>
pub fn rustc(&self) -> &Rustc
sourcepub fn linker(&self, kind: CompileKind) -> Option<PathBuf>
pub fn linker(&self, kind: CompileKind) -> Option<PathBuf>
Gets the user-specified linker for a particular host or target.
sourcepub fn host_triple(&self) -> InternedString
pub fn host_triple(&self) -> InternedString
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 rustflags_args(&self, unit: &Unit) -> &[String]
pub fn rustdocflags_args(&self, unit: &Unit) -> &[String]
pub fn extra_args_for(&self, unit: &Unit) -> Option<&Vec<String>>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more