Convert vk_bitflags_wrapped! methods to const fn (#549)

This commit is contained in:
thorjelly 2022-01-11 08:49:53 -08:00 committed by GitHub
parent 03068a8734
commit 98192d11f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,17 +20,17 @@ macro_rules! vk_bitflags_wrapped {
self.0
}
#[inline]
pub fn is_empty(self) -> bool {
self == Self::empty()
pub const fn is_empty(self) -> bool {
self.0 == Self::empty().0
}
#[inline]
pub fn intersects(self, other: Self) -> bool {
self & other != Self::empty()
pub const fn intersects(self, other: Self) -> bool {
!Self(self.0 & other.0).is_empty()
}
#[doc = r" Returns whether `other` is a subset of `self`"]
#[inline]
pub fn contains(self, other: Self) -> bool {
self & other == other
pub const fn contains(self, other: Self) -> bool {
self.0 & other.0 == other.0
}
}
impl ::std::ops::BitOr for $name {