diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -313,6 +313,7 @@ impl Builder { (&self.options.allowlisted_functions, "--allowlist-function"), (&self.options.allowlisted_types, "--allowlist-type"), (&self.options.allowlisted_vars, "--allowlist-var"), + (&self.options.allowlisted_files, "--allowlist-file"), (&self.options.no_partialeq_types, "--no-partialeq"), (&self.options.no_copy_types, "--no-copy"), (&self.options.no_debug_types, "--no-debug"), @@ -908,6 +909,12 @@ impl Builder { self } + /// Allowlist the given file so that its contents appear in the generated bindings. + pub fn allowlist_file<T: AsRef<str>>(mut self, arg: T) -> Builder { + self.options.allowlisted_files.insert(arg); + self + } + /// Deprecated: use allowlist_var instead. #[deprecated(note = "use allowlist_var instead")] pub fn whitelist_var<T: AsRef<str>>(self, arg: T) -> Builder { @@ -1705,6 +1712,9 @@ struct BindgenOptions { /// Allowlisted variables. See docs for `allowlisted_types` for more. allowlisted_vars: RegexSet, + /// The set of files whose contents should be allowlisted. + allowlisted_files: RegexSet, + /// The default style of code to generate for enums default_enum_style: codegen::EnumVariation, @@ -1984,6 +1994,7 @@ impl BindgenOptions { &mut self.allowlisted_vars, &mut self.allowlisted_types, &mut self.allowlisted_functions, + &mut self.allowlisted_files, &mut self.blocklisted_types, &mut self.blocklisted_functions, &mut self.blocklisted_items, @@ -2042,6 +2053,7 @@ impl Default for BindgenOptions { allowlisted_types: Default::default(), allowlisted_functions: Default::default(), allowlisted_vars: Default::default(), + allowlisted_files: Default::default(), default_enum_style: Default::default(), bitfield_enums: Default::default(), newtype_enums: Default::default(), |