Skip to content

Commit

Permalink
Improve the blocklist_* and allowlist_* documentation. (#2554)
Browse files Browse the repository at this point in the history
* Explicitly mention that `blocklist` methods are not recursive

* Mention that `blocklist_file` and `allowlist_file` match the whole path of the file
  • Loading branch information
pvdrz committed Jun 14, 2023
1 parent bbeddb6 commit 2665f1c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bindgen/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ options! {
methods: {
regex_option! {
/// Do not generate any bindings for the given type.
///
/// This option is not recursive, meaning that it will only block types whose names
/// explicitly match the argument of this method.
pub fn blocklist_type<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blocklisted_types.insert(arg);
self
Expand All @@ -171,6 +174,9 @@ options! {
methods: {
regex_option! {
/// Do not generate any bindings for the given function.
///
/// This option is not recursive, meaning that it will only block functions whose
/// names explicitly match the argument of this method.
pub fn blocklist_function<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blocklisted_functions.insert(arg);
self
Expand All @@ -185,6 +191,9 @@ options! {
regex_option! {
/// Do not generate any bindings for the given item, regardless of whether it is a
/// type, function, module, etc.
///
/// This option is not recursive, meaning that it will only block items whose names
/// explicitly match the argument of this method.
pub fn blocklist_item<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blocklisted_items.insert(arg);
self
Expand All @@ -199,6 +208,12 @@ options! {
regex_option! {
/// Do not generate any bindings for the contents of the given file, regardless of
/// whether the contents of the file are types, functions, modules, etc.
///
/// This option is not recursive, meaning that it will only block files whose names
/// explicitly match the argument of this method.
///
/// This method will use the argument to match the complete path of the file
/// instead of a section of it.
pub fn blocklist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.blocklisted_files.insert(arg);
self
Expand Down Expand Up @@ -319,6 +334,9 @@ options! {
///
/// This option is transitive by default. Check the documentation of the
/// [`Builder::allowlist_recursively`] method for further information.
///
/// This method will use the argument to match the complete path of the file
/// instead of a section of it.
pub fn allowlist_file<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.allowlisted_files.insert(arg);
self
Expand Down

0 comments on commit 2665f1c

Please sign in to comment.