diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-05-03 04:46:48 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-05-03 04:52:24 +0200 |
commit | 786ed31d471ba01a30343efdc6b341959801b939 (patch) | |
tree | f43a726b3e0820fcf2aea04b354a6cdfec2eb11d | |
parent | f7b0b170a0e3aee7d7da3527fca904b11ed99a98 (diff) |
lib: Add a more-convenient API to add multiple lines to the same module.
-rw-r--r-- | src/lib.rs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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()); |