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

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

impl VkWrappedType<RawVkDeviceGroupPresentModeFlags> for VkDeviceGroupPresentModeFlags {
    fn vk_to_raw(src: &VkDeviceGroupPresentModeFlags, dst: &mut RawVkDeviceGroupPresentModeFlags) {
        *dst = 0;
        if src.local { *dst |= 0x00000001; }
        if src.remote { *dst |= 0x00000002; }
        if src.sum { *dst |= 0x00000004; }
        if src.local_multi_device { *dst |= 0x00000008; }
    }
}

impl VkRawType<VkDeviceGroupPresentModeFlags> for RawVkDeviceGroupPresentModeFlags {
    fn vk_to_wrapped(src: &RawVkDeviceGroupPresentModeFlags) -> VkDeviceGroupPresentModeFlags {
        VkDeviceGroupPresentModeFlags {
            local: (src & 0x00000001) != 0,
            remote: (src & 0x00000002) != 0,
            sum: (src & 0x00000004) != 0,
            local_multi_device: (src & 0x00000008) != 0,
        }
    }
}

impl Default for VkDeviceGroupPresentModeFlags {
    fn default() -> VkDeviceGroupPresentModeFlags {
        VkDeviceGroupPresentModeFlags {
            local: false,
            remote: false,
            sum: false,
            local_multi_device: false,
        }
    }
}

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

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