mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 14:56:42 +00:00
Merge pull request #520 from dylanede/master
Support for taking differences of extension and feature sets
This commit is contained in:
commit
1c44b5b13b
@ -89,6 +89,17 @@ macro_rules! features {
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds a `Features` that is the difference of another `Features` object from `self`.
|
||||
///
|
||||
/// The result's field will be true if it is true in `self` but not `other`.
|
||||
pub fn difference(&self, other: &Features) -> Features {
|
||||
Features {
|
||||
$(
|
||||
$name: self.$name && !other.$name,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -61,6 +61,17 @@ macro_rules! extensions {
|
||||
_unbuildable: Unbuildable(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the difference of another list from this list.
|
||||
#[inline]
|
||||
pub fn difference(&self, other: &$sname) -> $sname {
|
||||
$sname {
|
||||
$(
|
||||
$ext: self.$ext && !other.$ext,
|
||||
)*
|
||||
_unbuildable: Unbuildable(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for $sname {
|
||||
@ -110,6 +121,11 @@ macro_rules! extensions {
|
||||
$rawname(self.0.intersection(&other.0).cloned().collect())
|
||||
}
|
||||
|
||||
/// Returns the difference of another set from this one.
|
||||
pub fn difference(&self, other: &Self) -> Self {
|
||||
$rawname(self.0.difference(&other.0).cloned().collect())
|
||||
}
|
||||
|
||||
// TODO: impl Iterator
|
||||
pub fn iter(&self) -> ::std::collections::hash_set::Iter<CString> { self.0.iter() }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user