pub struct Build { /* private fields */ }
Expand description
A builder for compilation of a native library.
A Build
is the main type of the cc
crate and is used to control all the
various configuration options and such of a compile. You’ll find more
documentation on each method itself.
Implementations§
Source§impl Build
impl Build
Sourcepub fn new() -> Build
pub fn new() -> Build
Construct a new instance of a blank set of configuration.
This builder is finished with the compile
function.
Sourcepub fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Build
pub fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Build
Add a directory to the -I
or include path for headers
§Example
use std::path::Path;
let library_path = Path::new("/path/to/library");
cc::Build::new()
.file("src/foo.c")
.include(library_path)
.include("src")
.compile("foo");
Sourcepub fn includes<P>(&mut self, dirs: P) -> &mut Build
pub fn includes<P>(&mut self, dirs: P) -> &mut Build
Add multiple directories to the -I
include path.
§Example
let mut extra_dir = None;
if condition {
extra_dir = Some(Path::new("/path/to"));
}
cc::Build::new()
.file("src/foo.c")
.includes(extra_dir)
.compile("foo");
Sourcepub fn define<'a, V: Into<Option<&'a str>>>(
&mut self,
var: &str,
val: V,
) -> &mut Build
pub fn define<'a, V: Into<Option<&'a str>>>( &mut self, var: &str, val: V, ) -> &mut Build
Specify a -D
variable with an optional value.
§Example
cc::Build::new()
.file("src/foo.c")
.define("FOO", "BAR")
.define("BAZ", None)
.compile("foo");
Sourcepub fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Build
pub fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Build
Add an arbitrary object file to link in
Sourcepub fn flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
pub fn flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
Add an arbitrary flag to the invocation of the compiler
§Example
cc::Build::new()
.file("src/foo.c")
.flag("-ffunction-sections")
.compile("foo");
Sourcepub fn remove_flag(&mut self, flag: &str) -> &mut Build
pub fn remove_flag(&mut self, flag: &str) -> &mut Build
Removes a compiler flag that was added by Build::flag
.
Will not remove flags added by other means (default flags, flags from env, and so on).
§Example
cc::Build::new()
.file("src/foo.c")
.flag("unwanted_flag")
.remove_flag("unwanted_flag");
Sourcepub fn ar_flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
pub fn ar_flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
Add a flag to the invocation of the ar
§Example
cc::Build::new()
.file("src/foo.c")
.file("src/bar.c")
.ar_flag("/NODEFAULTLIB:libc.dll")
.compile("foo");
Sourcepub fn asm_flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
pub fn asm_flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
Add a flag that will only be used with assembly files.
The flag will be applied to input files with either a .s
or
.asm
extension (case insensitive).
§Example
cc::Build::new()
.asm_flag("-Wa,-defsym,abc=1")
.file("src/foo.S") // The asm flag will be applied here
.file("src/bar.c") // The asm flag will not be applied here
.compile("foo");
Sourcepub fn is_flag_supported(&self, flag: impl AsRef<OsStr>) -> Result<bool, Error>
pub fn is_flag_supported(&self, flag: impl AsRef<OsStr>) -> Result<bool, Error>
Run the compiler to test if it accepts the given flag.
For a convenience method for setting flags conditionally,
see flag_if_supported()
.
It may return error if it’s unable to run the compiler with a test file
(e.g. the compiler is missing or a write to the out_dir
failed).
Note: Once computed, the result of this call is stored in the
known_flag_support
field. If is_flag_supported(flag)
is called again, the result will be read from the hash table.
Sourcepub fn flag_if_supported(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
pub fn flag_if_supported(&mut self, flag: impl AsRef<OsStr>) -> &mut Build
Add an arbitrary flag to the invocation of the compiler if it supports it
§Example
cc::Build::new()
.file("src/foo.c")
.flag_if_supported("-Wlogical-op") // only supported by GCC
.flag_if_supported("-Wunreachable-code") // only supported by clang
.compile("foo");
Sourcepub fn try_flags_from_environment(
&mut self,
environ_key: &str,
) -> Result<&mut Build, Error>
pub fn try_flags_from_environment( &mut self, environ_key: &str, ) -> Result<&mut Build, Error>
Add flags from the specified environment variable.
Normally the cc
crate will consult with the standard set of environment
variables (such as CFLAGS
and CXXFLAGS
) to construct the compiler invocation. Use of
this method provides additional levers for the end user to use when configuring the build
process.
Just like the standard variables, this method will search for an environment variable with appropriate target prefixes, when appropriate.
§Examples
This method is particularly beneficial in introducing the ability to specify crate-specific flags.
cc::Build::new()
.file("src/foo.c")
.try_flags_from_environment(concat!(env!("CARGO_PKG_NAME"), "_CFLAGS"))
.expect("the environment variable must be specified and UTF-8")
.compile("foo");
Set the -shared
flag.
When enabled, the compiler will produce a shared object which can then be linked with other objects to form an executable.
§Example
cc::Build::new()
.file("src/foo.c")
.shared_flag(true)
.compile("libfoo.so");
Sourcepub fn static_flag(&mut self, static_flag: bool) -> &mut Build
pub fn static_flag(&mut self, static_flag: bool) -> &mut Build
Set the -static
flag.
When enabled on systems that support dynamic linking, this prevents linking with the shared libraries.
§Example
cc::Build::new()
.file("src/foo.c")
.shared_flag(true)
.static_flag(true)
.compile("foo");
Sourcepub fn no_default_flags(&mut self, no_default_flags: bool) -> &mut Build
pub fn no_default_flags(&mut self, no_default_flags: bool) -> &mut Build
Disables the generation of default compiler flags. The default compiler flags may cause conflicts in some cross compiling scenarios.
Setting the CRATE_CC_NO_DEFAULTS
environment variable has the same
effect as setting this to true
. The presence of the environment
variable and the value of no_default_flags
will be OR’d together.
Sourcepub fn cpp(&mut self, cpp: bool) -> &mut Build
pub fn cpp(&mut self, cpp: bool) -> &mut Build
Set C++ support.
The other cpp_*
options will only become active if this is set to
true
.
The name of the C++ standard library to link is decided by:
- If
cpp_link_stdlib
is set, use its value. - Else if the
CXXSTDLIB
environment variable is set, use its value. - Else the default is
c++
for OS X and BSDs,c++_shared
for Android,None
for MSVC andstdc++
for anything else.
Sourcepub fn cuda(&mut self, cuda: bool) -> &mut Build
pub fn cuda(&mut self, cuda: bool) -> &mut Build
Set CUDA C++ support.
Enabling CUDA will invoke the CUDA compiler, NVCC. While NVCC accepts
the most common compiler flags, e.g. -std=c++17
, some project-specific
flags might have to be prefixed with “-Xcompiler” flag, for example as
.flag("-Xcompiler").flag("-fpermissive")
. See the documentation for
nvcc
, the CUDA compiler driver, at https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/
for more information.
If enabled, this also implicitly enables C++ support.
Sourcepub fn cudart(&mut self, cudart: &str) -> &mut Build
pub fn cudart(&mut self, cudart: &str) -> &mut Build
Link CUDA run-time.
This option mimics the --cudart
NVCC command-line option. Just like
the original it accepts {none|shared|static}
, with default being
static
. The method has to be invoked after .cuda(true)
, or not
at all, if the default is right for the project.
Sourcepub fn ccbin(&mut self, ccbin: bool) -> &mut Build
pub fn ccbin(&mut self, ccbin: bool) -> &mut Build
Set CUDA host compiler.
By default, a -ccbin
flag will be passed to NVCC to specify the
underlying host compiler. The value of -ccbin
is the same as the
chosen C++ compiler. This is not always desired, because NVCC might
not support that compiler. In this case, you can remove the -ccbin
flag so that NVCC will choose the host compiler by itself.
Sourcepub fn std(&mut self, std: &str) -> &mut Build
pub fn std(&mut self, std: &str) -> &mut Build
Specify the C or C++ language standard version.
These values are common to modern versions of GCC, Clang and MSVC:
c11
for ISO/IEC 9899:2011c17
for ISO/IEC 9899:2018c++14
for ISO/IEC 14882:2014c++17
for ISO/IEC 14882:2017c++20
for ISO/IEC 14882:2020
Other values have less broad support, e.g. MSVC does not support c++11
(c++14
is the minimum), c89
(omit the flag instead) or c99
.
For compiling C++ code, you should also set .cpp(true)
.
The default is that no standard flag is passed to the compiler, so the language version will be the compiler’s default.
§Example
cc::Build::new()
.file("src/modern.cpp")
.cpp(true)
.std("c++17")
.compile("modern");
Sourcepub fn warnings_into_errors(&mut self, warnings_into_errors: bool) -> &mut Build
pub fn warnings_into_errors(&mut self, warnings_into_errors: bool) -> &mut Build
Set warnings into errors flag.
Disabled by default.
Warning: turning warnings into errors only make sense if you are a developer of the crate using cc-rs. Some warnings only appear on some architecture or specific version of the compiler. Any user of this crate, or any other crate depending on it, could fail during compile time.
§Example
cc::Build::new()
.file("src/foo.c")
.warnings_into_errors(true)
.compile("libfoo.a");
Sourcepub fn warnings(&mut self, warnings: bool) -> &mut Build
pub fn warnings(&mut self, warnings: bool) -> &mut Build
Set warnings flags.
Adds some flags:
- “-Wall” for MSVC.
- “-Wall”, “-Wextra” for GNU and Clang.
Enabled by default.
§Example
cc::Build::new()
.file("src/foo.c")
.warnings(false)
.compile("libfoo.a");
Sourcepub fn extra_warnings(&mut self, warnings: bool) -> &mut Build
pub fn extra_warnings(&mut self, warnings: bool) -> &mut Build
Set extra warnings flags.
Adds some flags:
- nothing for MSVC.
- “-Wextra” for GNU and Clang.
Enabled by default.
§Example
// Disables -Wextra, -Wall remains enabled:
cc::Build::new()
.file("src/foo.c")
.extra_warnings(false)
.compile("libfoo.a");
Sourcepub fn cpp_link_stdlib<'a, V: Into<Option<&'a str>>>(
&mut self,
cpp_link_stdlib: V,
) -> &mut Build
pub fn cpp_link_stdlib<'a, V: Into<Option<&'a str>>>( &mut self, cpp_link_stdlib: V, ) -> &mut Build
Set the standard library to link against when compiling with C++ support.
If the CXXSTDLIB
environment variable is set, its value will
override the default value, but not the value explicitly set by calling
this function.
A value of None
indicates that no automatic linking should happen,
otherwise cargo will link against the specified library.
The given library name must not contain the lib
prefix.
Common values:
stdc++
for GNUc++
for Clangc++_shared
orc++_static
for Android
§Example
cc::Build::new()
.file("src/foo.c")
.shared_flag(true)
.cpp_link_stdlib("stdc++")
.compile("libfoo.so");
Sourcepub fn cpp_set_stdlib<'a, V: Into<Option<&'a str>>>(
&mut self,
cpp_set_stdlib: V,
) -> &mut Build
pub fn cpp_set_stdlib<'a, V: Into<Option<&'a str>>>( &mut self, cpp_set_stdlib: V, ) -> &mut Build
Force the C++ compiler to use the specified standard library.
Setting this option will automatically set cpp_link_stdlib
to the same
value.
The default value of this option is always None
.
This option has no effect when compiling for a Visual Studio based target.
This option sets the -stdlib
flag, which is only supported by some
compilers (clang, icc) but not by others (gcc). The library will not
detect which compiler is used, as such it is the responsibility of the
caller to ensure that this option is only used in conjunction with a
compiler which supports the -stdlib
flag.
A value of None
indicates that no specific C++ standard library should
be used, otherwise -stdlib
is added to the compile invocation.
The given library name must not contain the lib
prefix.
Common values:
stdc++
for GNUc++
for Clang
§Example
cc::Build::new()
.file("src/foo.c")
.cpp_set_stdlib("c++")
.compile("libfoo.a");
Sourcepub fn target(&mut self, target: &str) -> &mut Build
pub fn target(&mut self, target: &str) -> &mut Build
Configures the target this configuration will be compiling for.
This option is automatically scraped from the TARGET
environment
variable by build scripts, so it’s not required to call this function.
§Example
cc::Build::new()
.file("src/foo.c")
.target("aarch64-linux-android")
.compile("foo");
Sourcepub fn host(&mut self, host: &str) -> &mut Build
pub fn host(&mut self, host: &str) -> &mut Build
Configures the host assumed by this configuration.
This option is automatically scraped from the HOST
environment
variable by build scripts, so it’s not required to call this function.
§Example
cc::Build::new()
.file("src/foo.c")
.host("arm-linux-gnueabihf")
.compile("foo");
Sourcepub fn opt_level(&mut self, opt_level: u32) -> &mut Build
pub fn opt_level(&mut self, opt_level: u32) -> &mut Build
Configures the optimization level of the generated object files.
This option is automatically scraped from the OPT_LEVEL
environment
variable by build scripts, so it’s not required to call this function.
Sourcepub fn opt_level_str(&mut self, opt_level: &str) -> &mut Build
pub fn opt_level_str(&mut self, opt_level: &str) -> &mut Build
Configures the optimization level of the generated object files.
This option is automatically scraped from the OPT_LEVEL
environment
variable by build scripts, so it’s not required to call this function.
Sourcepub fn debug(&mut self, debug: bool) -> &mut Build
pub fn debug(&mut self, debug: bool) -> &mut Build
Configures whether the compiler will emit debug information when generating object files.
This option is automatically scraped from the DEBUG
environment
variable by build scripts, so it’s not required to call this function.
Sourcepub fn force_frame_pointer(&mut self, force: bool) -> &mut Build
pub fn force_frame_pointer(&mut self, force: bool) -> &mut Build
Configures whether the compiler will emit instructions to store frame pointers during codegen.
This option is automatically enabled when debug information is emitted. Otherwise the target platform compiler’s default will be used. You can use this option to force a specific setting.
Sourcepub fn out_dir<P: AsRef<Path>>(&mut self, out_dir: P) -> &mut Build
pub fn out_dir<P: AsRef<Path>>(&mut self, out_dir: P) -> &mut Build
Configures the output directory where all object files and static libraries will be located.
This option is automatically scraped from the OUT_DIR
environment
variable by build scripts, so it’s not required to call this function.
Sourcepub fn compiler<P: AsRef<Path>>(&mut self, compiler: P) -> &mut Build
pub fn compiler<P: AsRef<Path>>(&mut self, compiler: P) -> &mut Build
Configures the compiler to be used to produce output.
This option is automatically determined from the target platform or a number of environment variables, so it’s not required to call this function.
Sourcepub fn archiver<P: AsRef<Path>>(&mut self, archiver: P) -> &mut Build
pub fn archiver<P: AsRef<Path>>(&mut self, archiver: P) -> &mut Build
Configures the tool used to assemble archives.
This option is automatically determined from the target platform or a number of environment variables, so it’s not required to call this function.
Sourcepub fn ranlib<P: AsRef<Path>>(&mut self, ranlib: P) -> &mut Build
pub fn ranlib<P: AsRef<Path>>(&mut self, ranlib: P) -> &mut Build
Configures the tool used to index archives.
This option is automatically determined from the target platform or a number of environment variables, so it’s not required to call this function.
Sourcepub fn cargo_metadata(&mut self, cargo_metadata: bool) -> &mut Build
pub fn cargo_metadata(&mut self, cargo_metadata: bool) -> &mut Build
Define whether metadata should be emitted for cargo allowing it to
automatically link the binary. Defaults to true
.
The emitted metadata is:
rustc-link-lib=static=
compiled librustc-link-search=native=
target folder- When target is MSVC, the ATL-MFC libs are added via
rustc-link-search=native=
- When C++ is enabled, the C++ stdlib is added via
rustc-link-lib
- If
emit_rerun_if_env_changed
is notfalse
,rerun-if-env-changed=
env
Sourcepub fn cargo_warnings(&mut self, cargo_warnings: bool) -> &mut Build
pub fn cargo_warnings(&mut self, cargo_warnings: bool) -> &mut Build
Define whether compile warnings should be emitted for cargo. Defaults to
true
.
If disabled, compiler messages will not be printed. Issues unrelated to the compilation will always produce cargo warnings regardless of this setting.
Sourcepub fn cargo_debug(&mut self, cargo_debug: bool) -> &mut Build
pub fn cargo_debug(&mut self, cargo_debug: bool) -> &mut Build
Define whether debug information should be emitted for cargo. Defaults to whether
or not the environment variable CC_ENABLE_DEBUG_OUTPUT
is set.
If enabled, the compiler will emit debug information when generating object files, such as the command invoked and the exit status.
Sourcepub fn cargo_output(&mut self, cargo_output: bool) -> &mut Build
pub fn cargo_output(&mut self, cargo_output: bool) -> &mut Build
Define whether compiler output (to stdout) should be emitted. Defaults to true
(forward compiler stdout to this process’ stdout)
Some compilers emit errors to stdout, so if you really need stdout to be clean
you should also set this to false
.
Sourcepub fn link_lib_modifier(
&mut self,
link_lib_modifier: impl AsRef<OsStr>,
) -> &mut Build
pub fn link_lib_modifier( &mut self, link_lib_modifier: impl AsRef<OsStr>, ) -> &mut Build
Adds a native library modifier that will be added to the
rustc-link-lib=static:MODIFIERS=LIBRARY_NAME
metadata line
emitted for cargo if cargo_metadata
is enabled.
See https://doc.rust-lang.org/rustc/command-line-arguments.html#-l-link-the-generated-crate-to-a-native-library
for the list of modifiers accepted by rustc.
Sourcepub fn pic(&mut self, pic: bool) -> &mut Build
pub fn pic(&mut self, pic: bool) -> &mut Build
Configures whether the compiler will emit position independent code.
This option defaults to false
for windows-gnu
and bare metal targets and
to true
for all other targets.
Sourcepub fn use_plt(&mut self, use_plt: bool) -> &mut Build
pub fn use_plt(&mut self, use_plt: bool) -> &mut Build
Configures whether the Procedure Linkage Table is used for indirect calls into shared libraries.
The PLT is used to provide features like lazy binding, but introduces
a small performance loss due to extra pointer indirection. Setting
use_plt
to false
can provide a small performance increase.
Note that skipping the PLT requires a recent version of GCC/Clang.
This only applies to ELF targets. It has no effect on other platforms.
Sourcepub fn emit_rerun_if_env_changed(
&mut self,
emit_rerun_if_env_changed: bool,
) -> &mut Build
pub fn emit_rerun_if_env_changed( &mut self, emit_rerun_if_env_changed: bool, ) -> &mut Build
Define whether metadata should be emitted for cargo to detect environment changes that should trigger a rebuild.
NOTE that cc does not emit metadata to detect changes for PATH
, since it could
be changed every comilation yet does not affect the result of compilation
(i.e. rust-analyzer adds temporary directory to PATH
).
cc in general, has no way detecting changes to compiler, as there are so many ways to change it and sidestep the detection, for example the compiler might be wrapped in a script so detecting change of the file, or using checksum won’t work.
We recommend users to decide for themselves, if they want rebuild if the compiler has been upgraded or changed, and how to detect that.
This has no effect if the cargo_metadata
option is false
.
This option defaults to true
.
Sourcepub fn static_crt(&mut self, static_crt: bool) -> &mut Build
pub fn static_crt(&mut self, static_crt: bool) -> &mut Build
Configures whether the /MT flag or the /MD flag will be passed to msvc build tools.
This option defaults to false
, and affect only msvc targets.
Sourcepub fn shell_escaped_flags(&mut self, shell_escaped_flags: bool) -> &mut Build
pub fn shell_escaped_flags(&mut self, shell_escaped_flags: bool) -> &mut Build
Configure whether *FLAGS variables are parsed using shlex
, similarly to make
and
cmake
.
This option defaults to false
.
Sourcepub fn try_compile(&self, output: &str) -> Result<(), Error>
pub fn try_compile(&self, output: &str) -> Result<(), Error>
Run the compiler, generating the file output
This will return a result instead of panicking; see Self::compile()
for
the complete description.
Sourcepub fn compile(&self, output: &str)
pub fn compile(&self, output: &str)
Run the compiler, generating the file output
§Library name
The output
string argument determines the file name for the compiled
library. The Rust compiler will create an assembly named “lib”+output+“.a”.
MSVC will create a file named output+“.lib”.
The choice of output
is close to arbitrary, but:
- must be nonempty,
- must not contain a path separator (
/
), - must be unique across all
compile
invocations made by the same build script.
If your build script compiles a single source file, the base name of that source file would usually be reasonable:
cc::Build::new().file("blobstore.c").compile("blobstore");
Compiling multiple source files, some people use their crate’s name, or their crate’s name + “-cc”.
Otherwise, please use your imagination.
For backwards compatibility, if output
starts with “lib” and ends
with “.a”, a second “lib” prefix and “.a” suffix do not get added on,
but this usage is deprecated; please omit lib
and .a
in the argument
that you pass.
§Panics
Panics if output
is not formatted correctly or if one of the underlying
compiler commands fails. It can also panic if it fails reading file names
or creating directories.
Sourcepub fn compile_intermediates(&self) -> Vec<PathBuf>
pub fn compile_intermediates(&self) -> Vec<PathBuf>
Run the compiler, generating intermediate files, but without linking them into an archive file.
This will return a list of compiled object files, in the same order
as they were passed in as file
/files
methods.
Sourcepub fn try_compile_intermediates(&self) -> Result<Vec<PathBuf>, Error>
pub fn try_compile_intermediates(&self) -> Result<Vec<PathBuf>, Error>
Run the compiler, generating intermediate files, but without linking them into an archive file.
This will return a result instead of panicking; see compile_intermediates()
for the complete description.
Sourcepub fn try_expand(&self) -> Result<Vec<u8>, Error>
pub fn try_expand(&self) -> Result<Vec<u8>, Error>
This will return a result instead of panicking; see Self::expand()
for
the complete description.
Sourcepub fn get_compiler(&self) -> Tool
pub fn get_compiler(&self) -> Tool
Get the compiler that’s in use for this configuration.
This function will return a Tool
which represents the culmination
of this configuration at a snapshot in time. The returned compiler can
be inspected (e.g. the path, arguments, environment) to forward along to
other tools, or the to_command
method can be used to invoke the
compiler itself.
This method will take into account all configuration such as debug information, optimization level, include directories, defines, etc. Additionally, the compiler binary in use follows the standard conventions for this path, e.g. looking at the explicitly set compiler, environment variables (a number of which are inspected here), and then falling back to the default configuration.
§Panics
Panics if an error occurred while determining the architecture.
Sourcepub fn try_get_compiler(&self) -> Result<Tool, Error>
pub fn try_get_compiler(&self) -> Result<Tool, Error>
Get the compiler that’s in use for this configuration.
This will return a result instead of panicking; see
get_compiler()
for the complete description.
Sourcepub fn get_archiver(&self) -> Command
pub fn get_archiver(&self) -> Command
Get the archiver (ar) that’s in use for this configuration.
You can use Command::get_program
to get just the path to the command.
This method will take into account all configuration such as debug information, optimization level, include directories, defines, etc. Additionally, the compiler binary in use follows the standard conventions for this path, e.g. looking at the explicitly set compiler, environment variables (a number of which are inspected here), and then falling back to the default configuration.
§Panics
Panics if an error occurred while determining the architecture.
Sourcepub fn try_get_archiver(&self) -> Result<Command, Error>
pub fn try_get_archiver(&self) -> Result<Command, Error>
Get the archiver that’s in use for this configuration.
This will return a result instead of panicking;
see Self::get_archiver
for the complete description.
Sourcepub fn get_ranlib(&self) -> Command
pub fn get_ranlib(&self) -> Command
Get the ranlib that’s in use for this configuration.
You can use Command::get_program
to get just the path to the command.
This method will take into account all configuration such as debug information, optimization level, include directories, defines, etc. Additionally, the compiler binary in use follows the standard conventions for this path, e.g. looking at the explicitly set compiler, environment variables (a number of which are inspected here), and then falling back to the default configuration.
§Panics
Panics if an error occurred while determining the architecture.
Sourcepub fn try_get_ranlib(&self) -> Result<Command, Error>
pub fn try_get_ranlib(&self) -> Result<Command, Error>
Get the ranlib that’s in use for this configuration.
This will return a result instead of panicking;
see Self::get_ranlib
for the complete description.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Build
impl RefUnwindSafe for Build
impl Send for Build
impl Sync for Build
impl Unpin for Build
impl UnwindSafe for Build
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
)