Skip to content

Commit

Permalink
Rename BindgenExt::headers to Bindgen::path_headers to avoid collisio…
Browse files Browse the repository at this point in the history
…n with the existing bindgen::Builder::headers method
  • Loading branch information
ivmarkov committed Jan 1, 2025
1 parent f5840da commit a4b395a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking
- Module `espidf`: Support building with non-git repositories (#95)
- Module `espidf`: Provide tools exported env vars; do not assume that each installed tool is an executable binary
- Rename `BindgenExt::headers` to `Bindgen::path_headers` to avoid collision with the existing `bindgen::Builder::headers` method

### Added
- Add support for PlatformIO platform = native (#97)
Expand Down
5 changes: 3 additions & 2 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,15 @@ pub fn run_for_file(builder: bindgen::Builder, output_file: impl AsRef<Path>) ->
Ok(())
}

/// Extension trait for [`bindgen::Builder`].
/// Extension trait for [`bindgen::Builder`].
pub trait BindgenExt: Sized {
/// Add all input C/C++ headers using repeated [`bindgen::Builder::header`].
fn headers(self, headers: impl IntoIterator<Item = impl AsRef<Path>>) -> Result<Self>;
fn path_headers(self, headers: impl IntoIterator<Item = impl AsRef<Path>>) -> Result<Self>;
}

impl BindgenExt for bindgen::Builder {
fn headers(mut self, headers: impl IntoIterator<Item = impl AsRef<Path>>) -> Result<Self> {
fn path_headers(mut self, headers: impl IntoIterator<Item = impl AsRef<Path>>) -> Result<Self> {
for header in headers {
self = self.header(header.as_ref().try_to_str()?)
}
Expand Down

0 comments on commit a4b395a

Please sign in to comment.