Skip to content

Commit 2665f1c

Browse files
authored
Improve the blocklist_* and allowlist_* documentation. (rust-lang#2554)
* Explicitly mention that `blocklist` methods are not recursive * Mention that `blocklist_file` and `allowlist_file` match the whole path of the file
1 parent bbeddb6 commit 2665f1c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bindgen/options/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ options! {
158158
methods: {
159159
regex_option! {
160160
/// Do not generate any bindings for the given type.
161+
///
162+
/// This option is not recursive, meaning that it will only block types whose names
163+
/// explicitly match the argument of this method.
161164
pub fn blocklist_type<T: AsRef<str>>(mut self, arg: T) -> Builder {
162165
self.options.blocklisted_types.insert(arg);
163166
self
@@ -171,6 +174,9 @@ options! {
171174
methods: {
172175
regex_option! {
173176
/// Do not generate any bindings for the given function.
177+
///
178+
/// This option is not recursive, meaning that it will only block functions whose
179+
/// names explicitly match the argument of this method.
174180
pub fn blocklist_function<T: AsRef<str>>(mut self, arg: T) -> Builder {
175181
self.options.blocklisted_functions.insert(arg);
176182
self
@@ -185,6 +191,9 @@ options! {
185191
regex_option! {
186192
/// Do not generate any bindings for the given item, regardless of whether it is a
187193
/// type, function, module, etc.
194+
///
195+
/// This option is not recursive, meaning that it will only block items whose names
196+
/// explicitly match the argument of this method.
188197
pub fn blocklist_item<T: AsRef<str>>(mut self, arg: T) -> Builder {
189198
self.options.blocklisted_items.insert(arg);
190199
self
@@ -199,6 +208,12 @@ options! {
199208
regex_option! {
200209
/// Do not generate any bindings for the contents of the given file, regardless of
201210
/// whether the contents of the file are types, functions, modules, etc.
211+
///
212+
/// This option is not recursive, meaning that it will only block files whose names
213+
/// explicitly match the argument of this method.
214+
///
215+
/// This method will use the argument to match the complete path of the file
216+
/// instead of a section of it.
202217
pub fn blocklist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
203218
self.options.blocklisted_files.insert(arg);
204219
self
@@ -319,6 +334,9 @@ options! {
319334
///
320335
/// This option is transitive by default. Check the documentation of the
321336
/// [`Builder::allowlist_recursively`] method for further information.
337+
///
338+
/// This method will use the argument to match the complete path of the file
339+
/// instead of a section of it.
322340
pub fn allowlist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
323341
self.options.allowlisted_files.insert(arg);
324342
self

0 commit comments

Comments
 (0)