diff --git a/ash/src/vk.rs b/ash/src/vk.rs index bcd41b8..26be1ca 100644 --- a/ash/src/vk.rs +++ b/ash/src/vk.rs @@ -85,19 +85,19 @@ macro_rules! vk_bitflags_wrapped { } impl $name { #[inline] - pub fn empty() -> $name { + pub const fn empty() -> $name { $name(0) } #[inline] - pub fn all() -> $name { + pub const fn all() -> $name { $name($all) } #[inline] - pub fn from_raw(x: $flag_type) -> Self { + pub const fn from_raw(x: $flag_type) -> Self { $name(x) } #[inline] - pub fn as_raw(self) -> $flag_type { + pub const fn as_raw(self) -> $flag_type { self.0 } #[inline] @@ -199,7 +199,7 @@ macro_rules! handle_nondispatchable { } } impl $name { - pub fn null() -> $name { + pub const fn null() -> $name { $name(0) } } @@ -242,7 +242,7 @@ macro_rules! define_handle { unsafe impl Send for $name {} unsafe impl Sync for $name {} impl $name { - pub fn null() -> Self { + pub const fn null() -> Self { $name(::std::ptr::null_mut()) } } diff --git a/generator/src/lib.rs b/generator/src/lib.rs index a63ca4a..68928dc 100644 --- a/generator/src/lib.rs +++ b/generator/src/lib.rs @@ -122,7 +122,7 @@ pub fn define_handle_macro() -> Tokens { unsafe impl Sync for $name {} impl $name{ - pub fn null() -> Self{ + pub const fn null() -> Self{ $name(::std::ptr::null_mut()) } } @@ -163,7 +163,7 @@ pub fn handle_nondispatchable_macro() -> Tokens { } impl $name{ - pub fn null() -> $name{ + pub const fn null() -> $name{ $name(0) } } @@ -232,20 +232,20 @@ pub fn vk_bitflags_wrapped_macro() -> Tokens { impl $name { #[inline] - pub fn empty() -> $name { + pub const fn empty() -> $name { $name(0) } #[inline] - pub fn all() -> $name { + pub const fn all() -> $name { $name($all) } #[inline] - pub fn from_raw(x: $flag_type) -> Self { $name(x) } + pub const fn from_raw(x: $flag_type) -> Self { $name(x) } #[inline] - pub fn as_raw(self) -> $flag_type { self.0 } + pub const fn as_raw(self) -> $flag_type { self.0 } #[inline] pub fn is_empty(self) -> bool {