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

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

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

impl VkRawType<VkPipelineCacheCreateFlags> for RawVkPipelineCacheCreateFlags {
    fn vk_to_wrapped(src: &RawVkPipelineCacheCreateFlags) -> VkPipelineCacheCreateFlags {
        VkPipelineCacheCreateFlags {
            externally_synchronized_ext: (src & 0x00000001) != 0,
        }
    }
}

impl Default for VkPipelineCacheCreateFlags {
    fn default() -> VkPipelineCacheCreateFlags {
        VkPipelineCacheCreateFlags {
            externally_synchronized_ext: false,
        }
    }
}

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

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