#[auto_deviceinfo_impl]Expand description
Derive the implementation of the vulkan_layer::DeviceInfo trait from the implementation of the
vulkan_layer::DeviceHooks trait.
This attribute macro should be used over an implementation item of the
vulkan_layer::DeviceHooks trait, and will implement the vulkan_layer::DeviceInfo trait for
the type:
DeviceInfo::hooked_commandsreturns a list of the overridden methods that appear in the implementation item.DeviceInfo::HooksTypeandDeviceInfo::HooksRefTypeare defined asSelfand&Self.DeviceInfo::hooksreturnsself.
ยงExamples
use ash::vk;
use vulkan_layer::{
auto_deviceinfo_impl, DeviceHooks, DeviceInfo, LayerResult, LayerVulkanCommand,
};
#[derive(Default)]
struct MyDeviceHooks;
#[auto_deviceinfo_impl]
impl DeviceHooks for MyDeviceHooks {
fn create_image(
&self,
_p_create_info: &vk::ImageCreateInfo,
_p_allocator: Option<&vk::AllocationCallbacks>,
) -> LayerResult<ash::prelude::VkResult<vk::Image>> {
LayerResult::Unhandled
}
}
let my_device_hooks: MyDeviceHooks = Default::default();
assert!(std::ptr::eq(my_device_hooks.hooks(), &my_device_hooks));
assert_eq!(
MyDeviceHooks::hooked_commands(),
[LayerVulkanCommand::CreateImage]
);