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 self.0
} }
#[inline] #[inline]
pub fn is_empty(self) -> bool { pub const fn is_empty(self) -> bool {
self == Self::empty() self.0 == Self::empty().0
} }
#[inline] #[inline]
pub fn intersects(self, other: Self) -> bool { pub const fn intersects(self, other: Self) -> bool {
self & other != Self::empty() !Self(self.0 & other.0).is_empty()
} }
#[doc = r" Returns whether `other` is a subset of `self`"] #[doc = r" Returns whether `other` is a subset of `self`"]
#[inline] #[inline]
pub fn contains(self, other: Self) -> bool { pub const fn contains(self, other: Self) -> bool {
self & other == other self.0 & other.0 == other.0
} }
} }
impl ::std::ops::BitOr for $name { impl ::std::ops::BitOr for $name {