Skip to content

Commit

Permalink
Document and test allowlisting and blocklisting methods (#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Nov 11, 2022
1 parent 67dfa7e commit 4574d76
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 4574d76

Please sign in to comment.