summaryrefslogtreecommitdiff
path: root/libbindgen/src
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/src')
-rw-r--r--libbindgen/src/ir/context.rs4
-rw-r--r--libbindgen/src/lib.rs13
2 files changed, 8 insertions, 9 deletions
diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs
index d87c8f29..e3dc3384 100644
--- a/libbindgen/src/ir/context.rs
+++ b/libbindgen/src/ir/context.rs
@@ -924,7 +924,7 @@ impl<'ctx> BindgenContext<'ctx> {
pub fn hidden_by_name(&self, path: &[String], id: ItemId) -> bool {
debug_assert!(self.in_codegen_phase(),
"You're not supposed to call this yet");
- self.options.hidden_types.contains(&path[1..].join("::")) ||
+ self.options.hidden_types.matches(&path[1..].join("::")) ||
self.is_replaced_type(path, id)
}
@@ -941,7 +941,7 @@ impl<'ctx> BindgenContext<'ctx> {
pub fn opaque_by_name(&self, path: &[String]) -> bool {
debug_assert!(self.in_codegen_phase(),
"You're not supposed to call this yet");
- self.options.opaque_types.contains(&path[1..].join("::"))
+ self.options.opaque_types.matches(&path[1..].join("::"))
}
/// Get the options used to configure this bindgen context.
diff --git a/libbindgen/src/lib.rs b/libbindgen/src/lib.rs
index 372622d3..375fd212 100644
--- a/libbindgen/src/lib.rs
+++ b/libbindgen/src/lib.rs
@@ -84,7 +84,6 @@ use parse::{ClangItemParser, ParseError};
use regex_set::RegexSet;
use std::borrow::Borrow;
-use std::collections::HashSet;
use std::fs::OpenOptions;
use std::io::{self, Write};
use std::path::Path;
@@ -185,14 +184,14 @@ impl Builder {
}
/// Hide the given type from the generated bindings.
- pub fn hide_type<T: Into<String>>(mut self, arg: T) -> Builder {
- self.options.hidden_types.insert(arg.into());
+ pub fn hide_type<T: Borrow<str>>(mut self, arg: T) -> Builder {
+ self.options.hidden_types.insert(&arg);
self
}
/// Treat the given type as opaque in the generated bindings.
- pub fn opaque_type<T: Into<String>>(mut self, arg: T) -> Builder {
- self.options.opaque_types.insert(arg.into());
+ pub fn opaque_type<T: Borrow<str>>(mut self, arg: T) -> Builder {
+ self.options.opaque_types.insert(&arg);
self
}
@@ -364,11 +363,11 @@ impl Builder {
pub struct BindgenOptions {
/// The set of types that have been blacklisted and should not appear
/// anywhere in the generated code.
- pub hidden_types: HashSet<String>,
+ pub hidden_types: RegexSet,
/// The set of types that should be treated as opaque structures in the
/// generated code.
- pub opaque_types: HashSet<String>,
+ pub opaque_types: RegexSet,
/// The set of types that we should have bindings for in the generated
/// code.