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 [VkIndirectStateFlagsNV](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkIndirectStateFlagsNV.html).
///
/// Use the macro `VkIndirectStateFlags!` as an alternative method to create a structure. For example, these two snippets return the same value:
/// ```
/// VkIndirectStateFlags!(flag_frontface)
/// ```
/// ```
/// VkIndirectStateFlags {
///     flag_frontface: true,
/// }
/// ```
#[derive(Debug, Clone)]
pub struct VkIndirectStateFlags {
    pub flag_frontface: bool,
}

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

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

impl VkRawType<VkIndirectStateFlags> for RawVkIndirectStateFlags {
    fn vk_to_wrapped(src: &RawVkIndirectStateFlags) -> VkIndirectStateFlags {
        VkIndirectStateFlags {
            flag_frontface: (src & 0x00000001) != 0,
        }
    }
}

impl Default for VkIndirectStateFlags {
    fn default() -> VkIndirectStateFlags {
        VkIndirectStateFlags {
            flag_frontface: false,
        }
    }
}

impl VkIndirectStateFlags {
    
    /// Return a structure with all flags to `false`.
    pub fn none() -> Self {
        VkIndirectStateFlags {
            flag_frontface: false,
        }
    }
    
    /// Return a structure with all flags to `true`.
    pub fn all() -> Self {
        VkIndirectStateFlags {
            flag_frontface: 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.flag_frontface { 0x00000001 } else { 0 }
    }
    
    /// Create a structure corresponding to the specified numerical bit flags.
    pub fn from_u32(value: u32) -> Self {
        VkIndirectStateFlags {
            flag_frontface: value & 0x00000001 > 0,
        }
    }
}

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