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

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

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

impl VkRawType<VkImageViewCreateFlags> for RawVkImageViewCreateFlags {
    fn vk_to_wrapped(src: &RawVkImageViewCreateFlags) -> VkImageViewCreateFlags {
        VkImageViewCreateFlags {
            fragment_density_map_dynamic_ext: (src & 0x00000001) != 0,
        }
    }
}

impl Default for VkImageViewCreateFlags {
    fn default() -> VkImageViewCreateFlags {
        VkImageViewCreateFlags {
            fragment_density_map_dynamic_ext: false,
        }
    }
}

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

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