I'm trying to create my first Vulkan application using Rust following adrien ben's vulkan-tutorial.
As I progressed to commit 1.2.1 I noticed he is creating the winit-window for Windows.
Because I'm developing the application on my Linux-system I decided to leave the pre-scripted path, and try to implement the windowing-part on my own.
So I stumbled across the ash-window-crate which gives me a create-surface()
method that needs a window-handle
as a parameter.
My problem is as follows:
I'm not able to call the raw-window-handle function from my winit-window although the docs of winit suggest the Window-Struct implements the HasRawWindowHandle-Trait, which to my understanding would expose the aforementioned function.
I'm trying to create the KHRSurface like this:
let window = WindowBuilder::new().build(&events_loop).unwrap();;
let surface_khr = unsafe { create_surface(&entry, &instance, &window.raw_window_handle(), None).unwrap(); };
and the rust-compiler complains:
error[E0277]: the trait bound `RawWindowHandle: HasRawWindowHandle` is not satisfied
--> src/main.rs:46:70
|
46 | let surface_khr = unsafe { create_surface(&entry, &instance, &window.raw_window_handle(), None).unwrap(); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasRawWindowHandle` is not implemented for `RawWindowHandle`
|
= note: required for the cast to the object type `dyn HasRawWindowHandle`
As I'm quite new to the Rust programming language I'm not very familiar with the concept of traits and therefore any help would be very appreciated.