Can not return/move because owned by the current function. Seems the lifetime is the problem, normally this should work.
The device_physical
got a life time on it, like this: PhysicalDevice<'a>
inside Vulkan
struct. Aside of <'a>
infesting all the way up to the top struct with its need to be defined. It also makes Arc<Instance>
living shorter. I don't seem to find a way to add any 'a
to Arch<Instance>
to solve this problem. Nor can I remove the 'a
for device_physical
.
pub struct Vulkan<'a>
{
instance: Arc<Instance>,
device_physical: PhysicalDevice<'a>,
}
pub fn new() -> Vulkan<'a>
{
let required_extensions = vulkano_win::required_extensions();
let instance = Instance::new(None, &required_extensions, None).unwrap();
let device_physical = PhysicalDevice::enumerate(&instance).next().unwrap();
}
Vulkan
{
instance,
device_physical,
}
}