## Cc

# Struct Cc

Source

    pub struct Cc {
        cmd: Command,
    }

Expand description

A platform-specific C compiler invocation builder. The specific C compiler used is passed down from compiletest.

## Fields§

§`cmd: Command`

## Implementations§

Source§

### impl Cc

Source

#### pub fn into_raw_command(self) -> Command

In very rare circumstances, you may need a e.g. `bare_rustc()` or `bare_rustdoc()` with host runtime libs configured, but want the underlying raw `std::process::Command` (e.g. for manipulating pipes or whatever). This function will consume the command wrapper and extract the underlying `std::process::Command`.

Caution: this will mean that you can no longer use the convenience methods on the command wrapper. Use as a last resort.

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 set_aux_fd<F: Into<OwnedFd>>( &mut self, new_fd: RawFd, fd: F, ) -> &mut Self

Set an auxiliary stream passed to the process, besides the stdio streams.

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 Cc

Source

#### pub fn new() -> Self

Construct a new platform-specific C compiler invocation.

WARNING: This means that what flags are accepted by the underlying C compile is platform- AND compiler-specific. Consult the relevant docs for `gcc`, `clang` and `mvsc`.

Source

#### pub fn new_cxx() -> Self

Construct a new platform-specific CXX compiler invocation. CXX_DEFAULT_FLAGS is passed from compiletest.

Source

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

Specify path of the input file.

Source

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

Adds directories to the list that the linker searches for libraries. Equivalent to `-L`.

Source

#### pub fn out_exe(&mut self, name: &str) -> &mut Self

Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler.

Source

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

Specify path of the output binary.

Source

#### pub fn optimize(&mut self) -> &mut Self

Optimize the output. Equivalent to `-O3` for GNU-compatible linkers or `-O2` for MSVC linkers.

## Trait Implementations§

Source§

### impl Debug for Cc

Source§

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

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl Freeze for Cc

§

### impl !RefUnwindSafe for Cc

§

### impl Send for Cc

§

### impl Sync for Cc

§

### impl Unpin for Cc

§

### impl !UnwindSafe for Cc

## Blanket Implementations§

§

### impl<T> Any for T
where T: 'static + ?Sized,

§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
§

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

§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

### impl<T> From<T> for T

§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

#### fn into(self) -> U

Calls `U::from(self)`.

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

§

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

§

#### type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

#### 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: 304 bytes