Add a union method to the extensions types. (#1125)

Add a `union` method to the extensions types.
This commit is contained in:
mitchmindtree 2018-11-30 10:14:43 +07:00 committed by Lucas Kent
parent a9704caea9
commit 51cc13a0f4
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@
- Add support for `#include "..."` and `#include <...>` directives within source - Add support for `#include "..."` and `#include <...>` directives within source
files. files.
- Add a `union` method for the extensions types.
# Version 0.11.1 (2018-11-16) # Version 0.11.1 (2018-11-16)

View File

@ -42,6 +42,17 @@ macro_rules! extensions {
} }
} }
/// Returns the union of this list and another list.
#[inline]
pub fn union(&self, other: &$sname) -> $sname {
$sname {
$(
$ext: self.$ext || other.$ext,
)*
_unbuildable: Unbuildable(())
}
}
/// Returns the intersection of this list and another list. /// Returns the intersection of this list and another list.
#[inline] #[inline]
pub fn intersection(&self, other: &$sname) -> $sname { pub fn intersection(&self, other: &$sname) -> $sname {