lava 0.4.9

Rust wrapper to manipulate Vulkan more conveniently than with bindings.
Documentation
// Generated by `scripts/generate.js`

use utils::c_bindings::*;
use utils::vk_traits::*;
use utils::vk_ptr::*;
use utils::vk_convert::*;
use std::os::raw::c_char;
use std::ops::Drop;
use std::ptr;
use std::mem;
use std::cmp;
use std::slice;
use vulkan::*;
use vulkan::vk::*;

#[doc(hidden)]
pub type RawVkFence = u64;

/// Wrapper for [VkFence](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFence.html).
#[derive(Debug, Clone, Copy)]
pub struct VkFence {
    _handle: RawVkFence,
    _fn_table: *mut VkFunctionTable
}

impl VkRawType<VkFence> for RawVkFence {
    fn vk_to_wrapped(src: &RawVkFence) -> VkFence {
        VkFence {
            _handle: *src,
            _fn_table: ptr::null_mut()
        }
    }
}

impl VkWrappedType<RawVkFence> for VkFence {
    fn vk_to_raw(src: &VkFence, dst: &mut RawVkFence) {
        *dst = src._handle
    }
}

impl Default for VkFence {
    fn default() -> VkFence {
        VkFence {
            _handle: 0,
            _fn_table: ptr::null_mut()
        }
    }
}

impl PartialEq for VkFence {
    fn eq(&self, other: &VkFence) -> bool {
        self._handle == other._handle
    }
}

impl VkSetup for VkFence {
    fn vk_setup(&mut self, fn_table: *mut VkFunctionTable) {
        self._fn_table = fn_table;
    }
}

impl VkFence {
    
    /// Returns the internal Vulkan handle for the object.
    pub fn vk_handle(&self) -> u64 {
        self._handle
    }
    
    /// Indicates if the Vulkan internal handle for this object is 0.
    pub fn is_null(&self) -> bool {
        self._handle == 0
    }
    
    /// Creates an object with a null Vulkan internal handle.
    ///
    /// Calling a method with a null handle will most likely result in a crash.
    pub fn null() -> Self {
        Self {
            _handle: 0,
            _fn_table: ptr::null_mut()
        }
    }
    
    /// Wrapper for [vkDestroyFence](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkDestroyFence.html).
    pub fn destroy(&self) {
        unsafe {
            ((&*self._fn_table).vkDestroyFence)((*self._fn_table).device, self._handle, ptr::null());
        }
    }
    
    /// Wrapper for [vkGetFenceStatus](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetFenceStatus.html).
    pub fn get_status(&self) -> VkResult {
        unsafe {
            let vk_result = ((&*self._fn_table).vkGetFenceStatus)((*self._fn_table).device, self._handle);
            RawVkResult::vk_to_wrapped(&vk_result)
        }
    }
}