Skip to content

Commit 4574d76

Browse files
authored
Document and test allowlisting and blocklisting methods (#2344)
1 parent 67dfa7e commit 4574d76

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

bindgen-tests/tests/expectations/tests/blocklist-methods.rs

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// bindgen-flags: --blocklist-function="Foo_ba.*"
2+
3+
class Foo {
4+
public:
5+
int foo();
6+
int bar();
7+
int baz();
8+
};

bindgen/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,10 @@ impl Builder {
850850
/// Hide the given function from the generated bindings. Regular expressions
851851
/// are supported.
852852
///
853+
/// Methods can be blocklisted by prefixing the name of the type implementing
854+
/// them followed by an underscore. So if `Foo` has a method `bar`, it can
855+
/// be blocklisted as `Foo_bar`.
856+
///
853857
/// To blocklist functions prefixed with "mylib" use `"mylib_.*"`.
854858
/// For more complicated expressions check
855859
/// [regex](https://docs.rs/regex/*/regex/) docs
@@ -929,6 +933,10 @@ impl Builder {
929933
/// transitively refers to) appears in the generated bindings. Regular
930934
/// expressions are supported.
931935
///
936+
/// Methods can be allowlisted by prefixing the name of the type
937+
/// implementing them followed by an underscore. So if `Foo` has a method
938+
/// `bar`, it can be allowlisted as `Foo_bar`.
939+
///
932940
/// To allowlist functions prefixed with "mylib" use `"mylib_.*"`.
933941
/// For more complicated expressions check
934942
/// [regex](https://docs.rs/regex/*/regex/) docs

0 commit comments

Comments
 (0)