run_make_support::external_deps::rustc

Struct Rustc

source
pub struct Rustc {
    cmd: Command,
}
Expand description

A rustc invocation builder.

Fields§

§cmd: Command

Implementations§

source§

impl Rustc

source

pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Self
where K: AsRef<OsStr>, V: AsRef<OsStr>,

Specify an environment variable.

source

pub fn env_remove<K>(&mut self, key: K) -> &mut Self
where K: AsRef<OsStr>,

Remove an environmental variable.

source

pub fn arg<S>(&mut self, arg: S) -> &mut Self
where S: AsRef<OsStr>,

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.

source

pub fn args<V, S>(&mut self, args: V) -> &mut Self
where V: AsRef<[S]>, S: AsRef<OsStr>,

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.

source

pub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard input (stdin) handle.

See std::process::Command::stdin.

source

pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard output (stdout) handle.

See std::process::Command::stdout.

source

pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard error (stderr) handle.

See std::process::Command::stderr.

source

pub fn inspect<I>(&mut self, inspector: I) -> &mut Self
where I: FnOnce(&Command),

Inspect what the underlying Command is up to the current construction.

source

pub fn run(&mut self) -> CompletedProcess

Run the constructed command and assert that it is successfully run.

source

pub fn run_fail(&mut self) -> CompletedProcess

Run the constructed command and assert that it does not successfully run.

source

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.

source

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

source

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.

source

pub fn bare() -> Self

Construct a bare rustc invocation with no flags set.

source

pub fn new_aux_build() -> Self

Construct a new rustc invocation with aux_build preset (setting --crate-type=lib).

source

pub fn cfg(&mut self, s: &str) -> &mut Self

Configure the compilation environment.

source

pub fn opt(&mut self) -> &mut Self

Specify default optimization level -O (alias for -C opt-level=2).

source

pub fn opt_level(&mut self, option: &str) -> &mut Self

Specify a specific optimization level.

source

pub fn metadata(&mut self, meta: &str) -> &mut Self

Incorporate a hashed string to mangled symbols.

source

pub fn extra_filename(&mut self, suffix: &str) -> &mut Self

Add a suffix in each output filename.

source

pub fn emit<S: AsRef<str>>(&mut self, kinds: S) -> &mut Self

Specify type(s) of output files to generate.

source

pub fn extern_<P: AsRef<Path>>( &mut self, crate_name: &str, path: P, ) -> &mut Self

Specify where an external library is located.

source

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.

source

pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify path to the input file.

source

pub fn set_backtrace_level<R: AsRef<OsStr>>(&mut self, level: R) -> &mut Self

source

pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify path to the output file. Equivalent to `-o`` in rustc.

source

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.

source

pub fn linker_plugin_lto(&mut self, option: &str) -> &mut Self

This flag defers LTO optimizations to the linker.

source

pub fn panic(&mut self, option: &str) -> &mut Self

Specify what happens when the code panics.

source

pub fn codegen_units(&mut self, units: usize) -> &mut Self

Specify number of codegen units

source

pub fn incremental<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify directory path used for incremental cache

source

pub fn profile_generate<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify directory path used for profile generation

source

pub fn profile_use<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Specify directory path used for profile usage

source

pub fn error_format(&mut self, format: &str) -> &mut Self

Specify error format to use

source

pub fn json(&mut self, items: &str) -> &mut Self

Specify json messages printed by the compiler

source

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.

source

pub fn crate_type(&mut self, crate_type: &str) -> &mut Self

Specify the crate type.

source

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.

source

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.

source

pub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Override the system root. Equivalent to --sysroot in rustc.

source

pub fn edition(&mut self, edition: &str) -> &mut Self

Specify the edition year.

source

pub fn print(&mut self, request: &str) -> &mut Self

Specify the print request.

Add an extra argument to the linker invocation, via -Clink-arg.

Add multiple extra arguments to the linker invocation, via -Clink-args.

source

pub fn stdin_buf<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self

Specify a stdin input buffer.

source

pub fn crate_name<S: AsRef<OsStr>>(&mut self, name: S) -> &mut Self

Specify the crate name.

source

pub fn linker(&mut self, linker: &str) -> &mut Self

Specify the linker

source

pub fn linker_flavor(&mut self, linker_flavor: &str) -> &mut Self

Specify the linker flavor

source

pub fn extra_rs_cxx_flags(&mut self) -> &mut Self

EXTRARSCXXFLAGS

Trait Implementations§

source§

impl Debug for Rustc

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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