Skip to content

Commit

Permalink
Document and test allowlisting and blocklisting methods (rust-lang#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz authored and LoganBarnett committed Dec 2, 2023
1 parent 4fa0b34 commit 1a9fead
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bindgen-tests/tests/expectations/tests/blocklist-methods.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions bindgen-tests/tests/headers/blocklist-methods.hpp
@@ -0,0 +1,8 @@
// bindgen-flags: --blocklist-function="Foo_ba.*"

class Foo {
public:
int foo();
int bar();
int baz();
};
8 changes: 8 additions & 0 deletions bindgen/lib.rs
Expand Up @@ -850,6 +850,10 @@ impl Builder {
/// Hide the given function from the generated bindings. Regular expressions
/// are supported.
///
/// Methods can be blocklisted by prefixing the name of the type implementing
/// them followed by an underscore. So if `Foo` has a method `bar`, it can
/// be blocklisted as `Foo_bar`.
///
/// To blocklist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
Expand Down Expand Up @@ -929,6 +933,10 @@ impl Builder {
/// transitively refers to) appears in the generated bindings. Regular
/// expressions are supported.
///
/// Methods can be allowlisted by prefixing the name of the type
/// implementing them followed by an underscore. So if `Foo` has a method
/// `bar`, it can be allowlisted as `Foo_bar`.
///
/// To allowlist functions prefixed with "mylib" use `"mylib_.*"`.
/// For more complicated expressions check
/// [regex](https://docs.rs/regex/*/regex/) docs
Expand Down

0 comments on commit 1a9fead

Please sign in to comment.