summaryrefslogtreecommitdiff
path: root/libbindgen/src/lib.rs
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jsgf@fb.com>2017-01-05 18:55:44 -0800
committerJeremy Fitzhardinge <jsgf@fb.com>2017-01-05 18:55:44 -0800
commitef676c47cc746ea38e3b99ba6ef47e4b487197b4 (patch)
tree3f286258470e6d681666f19d5d98bbe3f795263a /libbindgen/src/lib.rs
parent6940219984b9131e67688e78116dda4352164dfc (diff)
Allow regexps for --blacklist_type and --opaque_type
Diffstat (limited to 'libbindgen/src/lib.rs')
-rw-r--r--libbindgen/src/lib.rs13
1 files changed, 6 insertions, 7 deletions
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.