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

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

impl VkWrappedType<RawVkPerformanceCounterDescriptionFlags> for VkPerformanceCounterDescriptionFlags {
    fn vk_to_raw(src: &VkPerformanceCounterDescriptionFlags, dst: &mut RawVkPerformanceCounterDescriptionFlags) {
        *dst = 0;
        if src.performance_impacting { *dst |= 0x00000001; }
        if src.concurrently_impacted { *dst |= 0x00000002; }
    }
}

impl VkRawType<VkPerformanceCounterDescriptionFlags> for RawVkPerformanceCounterDescriptionFlags {
    fn vk_to_wrapped(src: &RawVkPerformanceCounterDescriptionFlags) -> VkPerformanceCounterDescriptionFlags {
        VkPerformanceCounterDescriptionFlags {
            performance_impacting: (src & 0x00000001) != 0,
            concurrently_impacted: (src & 0x00000002) != 0,
        }
    }
}

impl Default for VkPerformanceCounterDescriptionFlags {
    fn default() -> VkPerformanceCounterDescriptionFlags {
        VkPerformanceCounterDescriptionFlags {
            performance_impacting: false,
            concurrently_impacted: false,
        }
    }
}

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

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