diff options
-rw-r--r-- | .github/ISSUE_TEMPLATE.md | 2 | ||||
-rw-r--r-- | bindgen-integration/build.rs | 2 | ||||
-rw-r--r-- | book/src/tutorial-3.md | 2 | ||||
-rw-r--r-- | src/lib.rs | 18 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rwxr-xr-x | tests/stylo_sanity.rs | 2 | ||||
-rw-r--r-- | tests/tests.rs | 16 |
7 files changed, 20 insertions, 26 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 86785dbb..442e0786 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -24,7 +24,7 @@ ```Rust bindgen::Builder::default() .header("input.h") - .gen() + .generate() .unwrap() ``` diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs index 76778379..77ea64b5 100644 --- a/bindgen-integration/build.rs +++ b/bindgen-integration/build.rs @@ -185,7 +185,7 @@ fn main() { .constified_enum("my_prefixed_enum_to_be_constified") .opaque_type("my_prefixed_templated_foo<my_prefixed_baz>") .depfile(out_rust_file_relative.display().to_string(), &out_dep_file) - .gen() + .generate() .expect("Unable to generate bindings"); assert!(macros.read().unwrap().contains("TESTMACRO")); diff --git a/book/src/tutorial-3.md b/book/src/tutorial-3.md index d4152ca2..139a24f9 100644 --- a/book/src/tutorial-3.md +++ b/book/src/tutorial-3.md @@ -32,7 +32,7 @@ fn main() { // included header files changed. .parse_callbacks(Box::new(bindgen::CargoCallbacks)) // Finish the builder and generate the bindings. - .gen() + .generate() // Unwrap the Result and panic on failure. .expect("Unable to generate bindings"); @@ -180,7 +180,7 @@ impl Default for CodegenConfig { /// let bindings = builder().header("path/to/input/header") /// .allowlist_type("SomeCoolClass") /// .allowlist_function("do_some_cool_thing") -/// .gen()?; +/// .generate()?; /// /// // Write the generated bindings to an output file. /// bindings.write_to_file("path/to/output.rs")?; @@ -247,7 +247,7 @@ impl Builder { // FIXME(emilio): This is a bit hacky, maybe we should stop re-using the // RustFeatures to store the "disable_untagged_union" call, and make it - // a different flag that we check elsewhere / in gen(). + // a different flag that we check elsewhere / in generate(). if !self.options.rust_features.untagged_union && RustFeatures::from(self.options.rust_target).untagged_union { @@ -595,7 +595,7 @@ impl Builder { /// ```ignore /// let bindings = bindgen::Builder::default() /// .header("input.h") - /// .gen() + /// .generate() /// .unwrap(); /// ``` /// @@ -607,7 +607,7 @@ impl Builder { /// .header("first.h") /// .header("second.h") /// .header("third.h") - /// .gen() + /// .generate() /// .unwrap(); /// ``` pub fn header<T: Into<String>>(mut self, header: T) -> Builder { @@ -1444,13 +1444,7 @@ 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(self) -> Result<Bindings, ()> { - self.gen().map_err(|_| ()) - } - - /// Generate the Rust bindings using the options built up thus far, or `Err` on failure. - pub fn gen(mut self) -> Result<Bindings, BindgenError> { + pub fn generate(mut self) -> Result<Bindings, BindgenError> { // 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") @@ -2697,7 +2691,7 @@ fn get_target_dependent_env_var(var: &str) -> Option<String> { /// let bindings = builder() /// .header("path/to/input/header") /// .parse_callbacks(Box::new(bindgen::CargoCallbacks)) -/// .gen(); +/// .generate(); /// ``` #[derive(Debug)] pub struct CargoCallbacks; diff --git a/src/main.rs b/src/main.rs index d8472fdb..f3398db8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,7 @@ pub fn main() { Ok((builder, output, verbose)) => { clang_version_check(); let builder_result = panic::catch_unwind(|| { - builder.gen().expect("Unable to generate bindings") + builder.generate().expect("Unable to generate bindings") }); if builder_result.is_err() { @@ -99,7 +99,7 @@ mod test { let (builder, _output, _verbose) = crate::options::builder_from_flags(command_line_flags.into_iter()) .unwrap(); - builder.gen().expect("failed to generate bindings"); + builder.generate().expect("failed to generate bindings"); } #[test] diff --git a/tests/stylo_sanity.rs b/tests/stylo_sanity.rs index 93b11473..39777cd1 100755 --- a/tests/stylo_sanity.rs +++ b/tests/stylo_sanity.rs @@ -540,7 +540,7 @@ fn sanity_check_can_generate_stylo_bindings() { .clang_arg("-DMOZ_STYLO") .clang_arg("-DOS_POSIX=1") .clang_arg("-DOS_LINUX=1") - .gen() + .generate() .expect("Should generate stylo bindings"); let now = Instant::now(); diff --git a/tests/tests.rs b/tests/tests.rs index 08781d46..ac0106ad 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -193,8 +193,8 @@ fn compare_generated_header( let (builder, roundtrip_builder) = builder.into_builder(check_roundtrip)?; - // We skip the gen() error here so we get a full diff below - let (actual, rustfmt_stderr) = match builder.gen() { + // We skip the generate() error here so we get a full diff below + let (actual, rustfmt_stderr) = match builder.generate() { Ok(bindings) => { let actual = bindings.to_string(); rustfmt(actual) @@ -426,7 +426,7 @@ fn test_clang_env_args() { #ifdef _ENV_TWO\nextern const int y[] = { 42 };\n#endif\n\ #ifdef NOT_THREE\nextern const int z[] = { 42 };\n#endif\n", ) - .gen() + .generate() .unwrap() .to_string(); @@ -453,7 +453,7 @@ fn test_header_contents() { .disable_header_comment() .header_contents("test.h", "int foo(const char* a);") .clang_arg("--target=x86_64-unknown-linux") - .gen() + .generate() .unwrap() .to_string(); @@ -480,7 +480,7 @@ fn test_multiple_header_calls_in_builder() { )) .header(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/char.h")) .clang_arg("--target=x86_64-unknown-linux") - .gen() + .generate() .unwrap() .to_string(); @@ -514,7 +514,7 @@ fn test_multiple_header_contents() { .header_contents("test.h", "int foo(const char* a);") .header_contents("test2.h", "float foo2(const char* b);") .clang_arg("--target=x86_64-unknown-linux") - .gen() + .generate() .unwrap() .to_string(); @@ -546,7 +546,7 @@ fn test_mixed_header_and_header_contents() { .header_contents("test.h", "int bar(const char* a);") .header_contents("test2.h", "float bar2(const char* b);") .clang_arg("--target=x86_64-unknown-linux") - .gen() + .generate() .unwrap() .to_string(); @@ -596,7 +596,7 @@ fn emit_depfile() { env::var_os("BINDGEN_DISABLE_ROUNDTRIP_TEST").is_none(); let (builder, _roundtrip_builder) = builder.into_builder(check_roundtrip).unwrap(); - let _bindings = builder.gen().unwrap(); + let _bindings = builder.generate().unwrap(); let observed = std::fs::read_to_string(observed_depfile).unwrap(); let expected = std::fs::read_to_string(expected_depfile).unwrap(); |