Skip to content

Commit 719d03c

Browse files
author
bors-servo
authored
Auto merge of rust-lang#636 - servo:clang_args, r=emilio
Add Builder::clang_args (plural) Use `AsRef<str>` rather than `Into<String>` because `&&str` (what you get when iterating `&[&str]`) does not implement the latter.
2 parents 8b1f7c0 + c5e044d commit 719d03c

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "bindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/servo/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
16-
version = "0.23.0"
16+
version = "0.23.1"
1717
build = "build.rs"
1818

1919
exclude = [

bindgen-integration/build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ fn main() {
3232
.enable_cxx_namespaces()
3333
.raw_line("pub use self::root::*;")
3434
.header("cpp/Test.h")
35-
.clang_arg("-x")
36-
.clang_arg("c++")
37-
.clang_arg("-std=c++11")
35+
.clang_args(&["-x", "c++", "-std=c++11"])
3836
.parse_callbacks(Box::new(MacroCallback {macros: macros.clone()}))
3937
.generate()
4038
.expect("Unable to generate bindings");

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,16 @@ impl Builder {
555555
self
556556
}
557557

558+
/// Add arguments to be passed straight through to clang.
559+
pub fn clang_args<I>(mut self, iter: I) -> Builder
560+
where I: IntoIterator,
561+
I::Item: AsRef<str> {
562+
for arg in iter {
563+
self = self.clang_arg(arg.as_ref())
564+
}
565+
self
566+
}
567+
558568
/// Make the generated bindings link the given shared library.
559569
pub fn link<T: Into<String>>(mut self, library: T) -> Builder {
560570
self.options.links.push((library.into(), LinkType::Default));

0 commit comments

Comments
 (0)