pub struct Tool { /* private fields */ }
Expand description
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§
Source§impl Tool
impl Tool
Sourcepub fn to_command(&self) -> Command
pub fn to_command(&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.
Sourcepub fn path(&self) -> &Path
pub fn path(&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.
Sourcepub fn args(&self) -> &[OsString]
pub fn args(&self) -> &[OsString]
Returns the default set of arguments to the compiler needed to produce executables for the target this compiler generates.
Sourcepub fn env(&self) -> &[(OsString, OsString)]
pub fn env(&self) -> &[(OsString, OsString)]
Returns the set of environment variables needed for this compiler to operate.
This is typically only used for MSVC compilers currently.
Sourcepub fn cc_env(&self) -> OsString
pub fn cc_env(&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
Sourcepub fn cflags_env(&self) -> OsString
pub fn cflags_env(&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
Sourcepub fn is_like_gnu(&self) -> bool
pub fn is_like_gnu(&self) -> bool
Whether the tool is GNU Compiler Collection-like.
Sourcepub fn is_like_clang(&self) -> bool
pub fn is_like_clang(&self) -> bool
Whether the tool is Clang-like.
Sourcepub fn is_like_msvc(&self) -> bool
pub fn is_like_msvc(&self) -> bool
Whether the tool is MSVC-like.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnwindSafe for Tool
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)