pub fn new<F>(create_window: F) -> Result<Self>
    where
        F: FnOnce(&mut glfw::Glfw) -> Result<(glfw::Window, EventReceiver)>,
    {
        let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS)
            .context("unable to setup glfw for this application")?;

        let (window, event_receiver) =
            Self::build_vulkan_window(&mut glfw, create_window)?;

        let instance =
            Instance::new(&glfw.get_required_instance_extensions().context(
                "unable to get required vulkan extensions for this platform",
            )?)?;

        let surface = Self::create_surface(&instance, &window)?;
        let surface_loader = instance.create_surface_loader();

        Ok(Self {
            surface,
            surface_loader,

            glfw,
            window,
            event_receiver,

            instance,
        })
    }
/// Create a new application window and vulkan surface.
///
/// It's safe to clone the the resulting window, but it is not safe to use
/// glfw window functions from any thread but the main thread. (the thread
/// where this `new` function was invoked).
///
Create a new application window and vulkan surface.
It's safe to clone the the resulting window, but it is not safe to use
glfw window functions from any thread but the main thread. (the thread
where this `new` function was invoked).
Create a new application window and vulkan surface . It ' s safe to clone the the resulting window but it is not safe to use glfw window functions from any thread but the main thread . ( the thread where this ` new ` function was invoked ) .
pub fn new<F>(create_window: F) -> Result<Self>
    where
        F: FnOnce(&mut glfw::Glfw) -> Result<(glfw::Window, EventReceiver)>,
    {
        let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS)
            .context("unable to setup glfw for this application")?;
        let (window, event_receiver) =
            Self::build_vulkan_window(&mut glfw, create_window)?;
        let instance =
            Instance::new(&glfw.get_required_instance_extensions().context(
                "unable to get required vulkan extensions for this platform",
            )?)?;
        let surface = Self::create_surface(&instance, &window)?;
        let surface_loader = instance.create_surface_loader();
        Ok(Self {
            surface,
            surface_loader,
            glfw,
            window,
            event_receiver,
            instance,
        })
    }
pub fn new < F > ( create_window : F ) -> Result < Self > where F : FnOnce ( & mut glfw :: Glfw ) -> Result < ( glfw :: Window , EventReceiver ) > , { let mut glfw = glfw :: init ( glfw :: FAIL_ON_ERRORS ) . context ( " " ) ? ; let ( window , event_receiver ) = Self :: build_vulkan_window ( & mut glfw , create_window ) ? ; let instance = Instance :: new ( & glfw . get_required_instance_extensions ( ) . context ( " " , ) ? ) ? ; let surface = Self :: create_surface ( & instance , & window ) ? ; let surface_loader = instance . create_surface_loader ( ) ; Ok ( Self { surface , surface_loader , glfw , window , event_receiver , instance , } ) }
Create a new application window and vulkan surface.
Create a new application window and vulkan surface .
create_window
F