#[auto_globalhooksinfo_impl]Expand description
Derive the implementation of the vulkan_layer::GlobalHooksInfo trait from the implementation
of the vulkan_layer::GlobalHooks trait.
This attribute macro should be used over an implementation item of the
vulkan_layer::GlobalHooks trait, and will implement the vulkan_layer::GlobalHooksInfo trait
for the type:
GlobalHooksInfo::hooked_commandsreturns a list of the overridden methods that appear in the implementation item.GlobalHooksInfo::HooksTypeandGlobalHooksInfo::HooksRefTypeare defined asSelfand&Self.GlobalHooksInfo::hooksreturnsself.
ยงExamples
use ash::vk;
use vulkan_layer::{
auto_globalhooksinfo_impl, GlobalHooks, GlobalHooksInfo, LayerResult, LayerVulkanCommand,
VkLayerInstanceLink,
};
#[derive(Default)]
struct MyGlobalHooks;
#[auto_globalhooksinfo_impl]
impl GlobalHooks for MyGlobalHooks {
fn create_instance(
&self,
_p_create_info: &vk::InstanceCreateInfo,
_layer_instance_link: &VkLayerInstanceLink,
_p_allocator: Option<&vk::AllocationCallbacks>,
_p_instance: *mut vk::Instance,
) -> LayerResult<ash::prelude::VkResult<()>> {
LayerResult::Unhandled
}
}
let my_global_hooks: MyGlobalHooks = Default::default();
assert!(std::ptr::eq(&my_global_hooks, my_global_hooks.hooks()));
assert_eq!(
MyGlobalHooks::hooked_commands(),
[LayerVulkanCommand::CreateInstance]
);