summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikuroXina <ryosukadnak@gmail.com>2021-12-04 16:58:26 +0900
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-12-29 20:39:01 +0100
commitb5e39bce5d34ff25f8ce8a99d803ae2286fd2a49 (patch)
treef94d8b813cd369f562f4668cb1013fda9e0882fa
parent66cc4598e4ca760db17ddbdf5202b3e20f8e5ae9 (diff)
Merge into new one
-rw-r--r--src/lib.rs34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 01fd027f..a95c433a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1445,38 +1445,8 @@ impl Builder {
/// Generate the Rust bindings using the options built up thus far.
#[deprecated(since = "0.59.3", note = "please use `gen` instead")]
- pub fn generate(mut self) -> Result<Bindings, ()> {
- // Add any extra arguments from the environment to the clang command line.
- if let Some(extra_clang_args) =
- get_target_dependent_env_var("BINDGEN_EXTRA_CLANG_ARGS")
- {
- // Try to parse it with shell quoting. If we fail, make it one single big argument.
- if let Some(strings) = shlex::split(&extra_clang_args) {
- self.options.clang_args.extend(strings);
- } else {
- self.options.clang_args.push(extra_clang_args);
- };
- }
-
- // Transform input headers to arguments on the clang command line.
- self.options.input_header = self.input_headers.pop();
- self.options.extra_input_headers = self.input_headers;
- self.options.clang_args.extend(
- self.options.extra_input_headers.iter().flat_map(|header| {
- iter::once("-include".into())
- .chain(iter::once(header.to_string()))
- }),
- );
-
- self.options.input_unsaved_files.extend(
- self.input_header_contents
- .drain(..)
- .map(|(name, contents)| {
- clang::UnsavedFile::new(&name, &contents)
- }),
- );
-
- Bindings::generate(self.options).map_err(|_| ())
+ pub fn generate(self) -> Result<Bindings, ()> {
+ self.gen().map_err(|_| ())
}
/// Generate the Rust bindings using the options built up thus far, or `Err` on failure.