Skip to content

Commit 33ea487

Browse files
Add flags method to cc::Build for adding multiple flags
1 parent 0342d85 commit 33ea487

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,19 @@ impl Build {
561561
self
562562
}
563563

564+
/// Add multiple flags to the invocation of the compiler.
565+
/// This is equivalent to calling `.flag()` for each item in the iterator.
566+
pub fn flags<Iter>(&mut self, flags: Iter) -> &mut Build
567+
where
568+
Iter: IntoIterator,
569+
Iter::Item: AsRef<OsStr>,
570+
{
571+
for flag in flags {
572+
self.flag(flag);
573+
}
574+
self
575+
}
576+
564577
/// Removes a compiler flag that was added by [`Build::flag`].
565578
///
566579
/// Will not remove flags added by other means (default flags,

0 commit comments

Comments
 (0)