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

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

impl VkWrappedType<RawVkIndirectCommandsLayoutUsageFlags> for VkIndirectCommandsLayoutUsageFlags {
    fn vk_to_raw(src: &VkIndirectCommandsLayoutUsageFlags, dst: &mut RawVkIndirectCommandsLayoutUsageFlags) {
        *dst = 0;
        if src.explicit_preprocess { *dst |= 0x00000001; }
        if src.indexed_sequences { *dst |= 0x00000002; }
        if src.unordered_sequences { *dst |= 0x00000004; }
    }
}

impl VkRawType<VkIndirectCommandsLayoutUsageFlags> for RawVkIndirectCommandsLayoutUsageFlags {
    fn vk_to_wrapped(src: &RawVkIndirectCommandsLayoutUsageFlags) -> VkIndirectCommandsLayoutUsageFlags {
        VkIndirectCommandsLayoutUsageFlags {
            explicit_preprocess: (src & 0x00000001) != 0,
            indexed_sequences: (src & 0x00000002) != 0,
            unordered_sequences: (src & 0x00000004) != 0,
        }
    }
}

impl Default for VkIndirectCommandsLayoutUsageFlags {
    fn default() -> VkIndirectCommandsLayoutUsageFlags {
        VkIndirectCommandsLayoutUsageFlags {
            explicit_preprocess: false,
            indexed_sequences: false,
            unordered_sequences: false,
        }
    }
}

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

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