Skip to content

Commit 2f4c233

Browse files
committed
lib: Add a more-convenient API to add multiple lines to the same module.
1 parent 656da58 commit 2f4c233

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,21 @@ impl Builder {
786786
self
787787
}
788788

789+
/// Add a given set of lines to the beginning of module `mod`.
790+
pub fn module_raw_lines<T, I>(mut self, mod_: T, lines: I) -> Self
791+
where
792+
T: Into<String>,
793+
I: IntoIterator,
794+
I::Item: Into<String>,
795+
{
796+
self.options
797+
.module_lines
798+
.entry(mod_.into())
799+
.or_insert_with(Vec::new)
800+
.extend(lines.into_iter().map(Into::into));
801+
self
802+
}
803+
789804
/// Add an argument to be passed straight through to clang.
790805
pub fn clang_arg<T: Into<String>>(mut self, arg: T) -> Builder {
791806
self.options.clang_args.push(arg.into());

0 commit comments

Comments
 (0)