pub trait Executor:
Send
+ Sync
+ 'static {
// Required method
fn exec(
&self,
cmd: ProcessBuilder,
id: PackageId,
target: &Target,
mode: CompileMode,
on_stdout_line: &mut dyn FnMut(&str) -> CargoResult<()>,
on_stderr_line: &mut dyn FnMut(&str) -> CargoResult<()>,
) -> CargoResult<()>;
// Provided methods
fn init<'a, 'cfg>(&self, _cx: &Context<'a, 'cfg>, _unit: &Unit<'a>) { ... }
fn force_rebuild(&self, _unit: &Unit<'_>) -> bool { ... }
}Expand description
A glorified callback for executing calls to rustc. Rather than calling rustc
directly, we’ll use an Executor, giving clients an opportunity to intercept
the build calls.
Required Methods§
Sourcefn exec(
&self,
cmd: ProcessBuilder,
id: PackageId,
target: &Target,
mode: CompileMode,
on_stdout_line: &mut dyn FnMut(&str) -> CargoResult<()>,
on_stderr_line: &mut dyn FnMut(&str) -> CargoResult<()>,
) -> CargoResult<()>
fn exec( &self, cmd: ProcessBuilder, id: PackageId, target: &Target, mode: CompileMode, on_stdout_line: &mut dyn FnMut(&str) -> CargoResult<()>, on_stderr_line: &mut dyn FnMut(&str) -> CargoResult<()>, ) -> CargoResult<()>
In case of an Err, Cargo will not continue with the build process for
this package.
Provided Methods§
Sourcefn init<'a, 'cfg>(&self, _cx: &Context<'a, 'cfg>, _unit: &Unit<'a>)
fn init<'a, 'cfg>(&self, _cx: &Context<'a, 'cfg>, _unit: &Unit<'a>)
Called after a rustc process invocation is prepared up-front for a given unit of work (may still be modified for runtime-known dependencies, when the work is actually executed).
Sourcefn force_rebuild(&self, _unit: &Unit<'_>) -> bool
fn force_rebuild(&self, _unit: &Unit<'_>) -> bool
Queried when queuing each unit of work. If it returns true, then the unit will always be rebuilt, independent of whether it needs to be.