summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-05-03 04:46:48 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-05-03 04:52:24 +0200
commit786ed31d471ba01a30343efdc6b341959801b939 (patch)
treef43a726b3e0820fcf2aea04b354a6cdfec2eb11d
parentf7b0b170a0e3aee7d7da3527fca904b11ed99a98 (diff)
lib: Add a more-convenient API to add multiple lines to the same module.
-rw-r--r--src/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9073800f..2c904056 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -786,6 +786,21 @@ impl Builder {
self
}
+ /// Add a given set of lines to the beginning of module `mod`.
+ pub fn module_raw_lines<T, I>(mut self, mod_: T, lines: I) -> Self
+ where
+ T: Into<String>,
+ I: IntoIterator,
+ I::Item: Into<String>,
+ {
+ self.options
+ .module_lines
+ .entry(mod_.into())
+ .or_insert_with(Vec::new)
+ .extend(lines.into_iter().map(Into::into));
+ self
+ }
+
/// Add an argument to be passed straight through to clang.
pub fn clang_arg<T: Into<String>>(mut self, arg: T) -> Builder {
self.options.clang_args.push(arg.into());