#[auto_instanceinfo_impl]Expand description
Derive the implementation of the vulkan_layer::InstanceInfo trait from the implementation of
the vulkan_layer::InstanceHooks.
This attribute macro should be used over an implementation item of the
vulkan_layer::InstanceHooks trait, and will implement the vulkan_layer::InstanceInfo trait
for the type:
InstanceInfo::hooked_commandsreturns a list of the overridden methods that appear in the implementation item.InstanceInfo::HooksTypeandInstanceInfo::HooksRefTypeare defined asSelfand&Self.InstanceInfo::hooksreturnsself.
ยงExamples
use ash::vk;
use std::mem::MaybeUninit;
use vulkan_layer::{
auto_instanceinfo_impl, InstanceHooks, InstanceInfo, LayerResult, LayerVulkanCommand,
};
#[derive(Default)]
struct MyInstanceHooks;
#[auto_instanceinfo_impl]
impl InstanceHooks for MyInstanceHooks {
fn get_physical_device_features(
&self,
_physical_device: vk::PhysicalDevice,
_p_features: &mut MaybeUninit<vk::PhysicalDeviceFeatures>,
) -> LayerResult<()> {
LayerResult::Unhandled
}
}
let my_instance_hooks: MyInstanceHooks = Default::default();
assert!(std::ptr::eq(my_instance_hooks.hooks(), &my_instance_hooks));
assert_eq!(
MyInstanceHooks::hooked_commands(),
[LayerVulkanCommand::GetPhysicalDeviceFeatures]
);