lava 0.4.9

Rust wrapper to manipulate Vulkan more conveniently than with bindings.
Documentation
// Generated by `scripts/generate.js`

use utils::vk_traits::*;

/// Wrapper for [VkSemaphoreWaitFlags](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkSemaphoreWaitFlags.html).
///
/// Use the macro `VkSemaphoreWaitFlags!` as an alternative method to create a structure. For example, these two snippets return the same value:
/// ```
/// VkSemaphoreWaitFlags!(any)
/// ```
/// ```
/// VkSemaphoreWaitFlags {
///     any: true,
/// }
/// ```
#[derive(Debug, Clone)]
pub struct VkSemaphoreWaitFlags {
    pub any: bool,
}

#[doc(hidden)]
pub type RawVkSemaphoreWaitFlags = u32;

impl VkWrappedType<RawVkSemaphoreWaitFlags> for VkSemaphoreWaitFlags {
    fn vk_to_raw(src: &VkSemaphoreWaitFlags, dst: &mut RawVkSemaphoreWaitFlags) {
        *dst = 0;
        if src.any { *dst |= 0x00000001; }
    }
}

impl VkRawType<VkSemaphoreWaitFlags> for RawVkSemaphoreWaitFlags {
    fn vk_to_wrapped(src: &RawVkSemaphoreWaitFlags) -> VkSemaphoreWaitFlags {
        VkSemaphoreWaitFlags {
            any: (src & 0x00000001) != 0,
        }
    }
}

impl Default for VkSemaphoreWaitFlags {
    fn default() -> VkSemaphoreWaitFlags {
        VkSemaphoreWaitFlags {
            any: false,
        }
    }
}

impl VkSemaphoreWaitFlags {
    
    /// Return a structure with all flags to `false`.
    pub fn none() -> Self {
        VkSemaphoreWaitFlags {
            any: false,
        }
    }
    
    /// Return a structure with all flags to `true`.
    pub fn all() -> Self {
        VkSemaphoreWaitFlags {
            any: true,
        }
    }
    
    /// Return the numerical bit flags corresponding to the structure (as described in the Vulkan specs).
    pub fn to_u32(&self) -> u32 {
        0
        + if self.any { 0x00000001 } else { 0 }
    }
    
    /// Create a structure corresponding to the specified numerical bit flags.
    pub fn from_u32(value: u32) -> Self {
        VkSemaphoreWaitFlags {
            any: value & 0x00000001 > 0,
        }
    }
}

#[doc(hidden)]
#[macro_export]
macro_rules! VkSemaphoreWaitFlags {
    ( $( $x:ident ),* ) => {
        VkSemaphoreWaitFlags {
            $($x: true,)*
            ..VkSemaphoreWaitFlags::none()
        }
    }
}