Struct run_make_support::external_deps::rustc::Rustc
source · 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 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 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: 280 bytes