Struct Tool

struct Tool { ... }

Configuration used to represent an invocation of a C compiler.

This can be used to figure out what compiler is in use, what the arguments to it are, and what the environment variables look like for the compiler. This can be used to further configure other build systems (e.g. forward along CC and/or CFLAGS) or the to_command method can be used to run the compiler itself.

Implementations

impl Tool

fn to_command(self: &Self) -> Command

Converts this compiler into a Command that's ready to be run.

This is useful for when the compiler needs to be executed and the command returned will already have the initial arguments and environment variables configured.

fn path(self: &Self) -> &Path

Returns the path for this compiler.

Note that this may not be a path to a file on the filesystem, e.g. "cc", but rather something which will be resolved when a process is spawned.

fn args(self: &Self) -> &[OsString]

Returns the default set of arguments to the compiler needed to produce executables for the target this compiler generates.

fn env(self: &Self) -> &[(OsString, OsString)]

Returns the set of environment variables needed for this compiler to operate.

This is typically only used for MSVC compilers currently.

fn cc_env(self: &Self) -> OsString

Returns the compiler command in format of CC environment variable. Or empty string if CC env was not present

This is typically used by configure script

fn cflags_env(self: &Self) -> OsString

Returns the compiler flags in format of CFLAGS environment variable. Important here - this will not be CFLAGS from env, its internal gcc's flags to use as CFLAGS This is typically used by configure script

fn is_like_gnu(self: &Self) -> bool

Whether the tool is GNU Compiler Collection-like.

fn is_like_clang(self: &Self) -> bool

Whether the tool is Clang-like.

fn is_like_msvc(self: &Self) -> bool

Whether the tool is MSVC-like.

fn is_like_clang_cl(self: &Self) -> bool

Whether the tool is clang-cl-based MSVC-like.

impl Clone for Tool

fn clone(self: &Self) -> Tool

impl Debug for Tool

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

impl Freeze for Tool

impl RefUnwindSafe for Tool

impl Send for Tool

impl Sync for Tool

impl Unpin for Tool

impl UnsafeUnpin for Tool

impl UnwindSafe for Tool

impl<T> Any for Tool

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Tool

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Tool

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

impl<T> CloneToUninit for Tool

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Tool

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Tool

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Tool

fn into(self: 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 for Tool

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

impl<T, U> TryInto for Tool

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