pub struct Rustc {
cmd: Command,
}
Expand description
A rustc
invocation builder.
Fields§
§cmd: Command
Implementations§
Source§impl Rustc
impl Rustc
Sourcepub fn env_remove<K>(&mut self, key: K) -> &mut Self
pub fn env_remove<K>(&mut self, key: K) -> &mut Self
Remove an environmental variable.
Sourcepub fn arg<S>(&mut self, arg: S) -> &mut Self
pub fn arg<S>(&mut self, arg: S) -> &mut Self
Generic command argument provider. Prefer specific helper methods if possible. Note that for some executables, arguments might be platform specific. For C/C++ compilers, arguments might be platform and compiler specific.
Sourcepub fn args<V, S>(&mut self, args: V) -> &mut Self
pub fn args<V, S>(&mut self, args: V) -> &mut Self
Generic command arguments provider. Prefer specific helper methods if possible. Note that for some executables, arguments might be platform specific. For C/C++ compilers, arguments might be platform and compiler specific.
Sourcepub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Configuration for the child process’s standard input (stdin) handle.
Sourcepub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Configuration for the child process’s standard output (stdout) handle.
Sourcepub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Configuration for the child process’s standard error (stderr) handle.
Sourcepub fn inspect<I>(&mut self, inspector: I) -> &mut Self
pub fn inspect<I>(&mut self, inspector: I) -> &mut Self
Inspect what the underlying Command
is up to the
current construction.
Sourcepub fn run(&mut self) -> CompletedProcess
pub fn run(&mut self) -> CompletedProcess
Run the constructed command and assert that it is successfully run.
Sourcepub fn run_fail(&mut self) -> CompletedProcess
pub fn run_fail(&mut self) -> CompletedProcess
Run the constructed command and assert that it does not successfully run.
Sourcepub fn run_unchecked(&mut self) -> CompletedProcess
pub fn run_unchecked(&mut self) -> CompletedProcess
Run the command but do not check its exit status.
Only use if you explicitly don’t care about the exit status.
Prefer to use Self::run
and Self::run_fail
whenever possible.
Sourcepub fn current_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn current_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Set the path where the command will be run.
Source§impl Rustc
impl Rustc
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new rustc
invocation. This will automatically set the library
search path as -L cwd()
. Use bare_rustc
to avoid this.
Sourcepub fn new_aux_build() -> Self
pub fn new_aux_build() -> Self
Construct a new rustc
invocation with aux_build
preset (setting --crate-type=lib
).
Sourcepub fn opt(&mut self) -> &mut Self
pub fn opt(&mut self) -> &mut Self
Specify default optimization level -O
(alias for -C opt-level=2
).
Sourcepub fn metadata(&mut self, meta: &str) -> &mut Self
pub fn metadata(&mut self, meta: &str) -> &mut Self
Incorporate a hashed string to mangled symbols.
Sourcepub fn extra_filename(&mut self, suffix: &str) -> &mut Self
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self
Add a suffix in each output filename.
Sourcepub fn emit<S: AsRef<str>>(&mut self, kinds: S) -> &mut Self
pub fn emit<S: AsRef<str>>(&mut self, kinds: S) -> &mut Self
Specify type(s) of output files to generate.
Sourcepub fn extern_<P: AsRef<Path>>(
&mut self,
crate_name: &str,
path: P,
) -> &mut Self
pub fn extern_<P: AsRef<Path>>( &mut self, crate_name: &str, path: P, ) -> &mut Self
Specify where an external library is located.
Sourcepub fn remap_path_prefix<P: AsRef<Path>, P2: AsRef<Path>>(
&mut self,
from: P,
to: P2,
) -> &mut Self
pub fn remap_path_prefix<P: AsRef<Path>, P2: AsRef<Path>>( &mut self, from: P, to: P2, ) -> &mut Self
Remap source path prefixes in all output.
pub fn set_backtrace_level<R: AsRef<OsStr>>(&mut self, level: R) -> &mut Self
Sourcepub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify path to the output file. Equivalent to `-o`` in rustc.
Sourcepub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify path to the output directory. Equivalent to `–out-dir`` in rustc.
Sourcepub fn linker_plugin_lto(&mut self, option: &str) -> &mut Self
pub fn linker_plugin_lto(&mut self, option: &str) -> &mut Self
This flag defers LTO optimizations to the linker.
Sourcepub fn codegen_units(&mut self, units: usize) -> &mut Self
pub fn codegen_units(&mut self, units: usize) -> &mut Self
Specify number of codegen units
Sourcepub fn incremental<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn incremental<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify directory path used for incremental cache
Sourcepub fn profile_generate<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn profile_generate<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify directory path used for profile generation
Sourcepub fn profile_use<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn profile_use<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Specify directory path used for profile usage
Sourcepub fn error_format(&mut self, format: &str) -> &mut Self
pub fn error_format(&mut self, format: &str) -> &mut Self
Specify error format to use
Sourcepub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self
pub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self
Specify the target triple, or a path to a custom target json spec file.
Sourcepub fn crate_type(&mut self, crate_type: &str) -> &mut Self
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self
Specify the crate type.
Sourcepub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Add a directory to the library search path. Equivalent to -L
in rustc.
Sourcepub fn specific_library_search_path<P: AsRef<Path>>(
&mut self,
kind: &str,
path: P,
) -> &mut Self
pub fn specific_library_search_path<P: AsRef<Path>>( &mut self, kind: &str, path: P, ) -> &mut Self
Add a directory to the library search path with a restriction, where kind
is a dependency
type. Equivalent to -L KIND=PATH
in rustc.
Sourcepub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Override the system root. Equivalent to --sysroot
in rustc.
Sourcepub fn link_arg(&mut self, link_arg: &str) -> &mut Self
pub fn link_arg(&mut self, link_arg: &str) -> &mut Self
Add an extra argument to the linker invocation, via -Clink-arg
.
Sourcepub fn link_args(&mut self, link_args: &str) -> &mut Self
pub fn link_args(&mut self, link_args: &str) -> &mut Self
Add multiple extra arguments to the linker invocation, via -Clink-args
.
Sourcepub fn stdin_buf<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self
pub fn stdin_buf<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self
Specify a stdin input buffer.
Sourcepub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self
pub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self
Specify the crate name.
Sourcepub fn linker_flavor(&mut self, linker_flavor: &str) -> &mut Self
pub fn linker_flavor(&mut self, linker_flavor: &str) -> &mut Self
Specify the linker flavor
Sourcepub fn extra_rs_cxx_flags(&mut self) -> &mut Self
pub fn extra_rs_cxx_flags(&mut self) -> &mut Self
EXTRARSCXXFLAGS
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rustc
impl !RefUnwindSafe for Rustc
impl Send for Rustc
impl Sync for Rustc
impl Unpin for Rustc
impl !UnwindSafe for Rustc
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 312 bytes