async fn app(window: Window, mut gfx: Graphics, mut input: Input) -> Result<()> {
    // Load the image and wait for it to finish
    // We also use '?' to handle errors like file-not-found
    let image = Image::load(&gfx, "image.png").await?;
    gfx.clear(Color::WHITE);
    // Draw the image with the top-left at (100, 100)
    let region = Rectangle::new(Vector::new(100.0, 100.0), image.size());
    gfx.draw_image(&image, region);
    gfx.present(&window)?;

    loop {
        while let Some(_) = input.next_event().await {}
    }
}
// This time we might return an error, so we use a Result
This time we might return an error, so we use a Result
This time we might return an error so we use a Result
async fn app(window: Window, mut gfx: Graphics, mut input: Input) -> Result<()> {
    // Load the image and wait for it to finish
    // We also use '?' to handle errors like file-not-found
    let image = Image::load(&gfx, "image.png").await?;
    gfx.clear(Color::WHITE);
    // Draw the image with the top-left at (100, 100)
    let region = Rectangle::new(Vector::new(100.0, 100.0), image.size());
    gfx.draw_image(&image, region);
    gfx.present(&window)?;
    loop {
        while let Some(_) = input.next_event().await {}
    }
}
async fn app ( window : Window , mut gfx : Graphics , mut input : Input ) -> Result < ( ) > { // Load the image and wait for it to finish // We also use '?' to handle errors like file-not-found let image = Image :: load ( & gfx , " " ) . await ? ; gfx . clear ( Color :: WHITE ) ; // Draw the image with the top-left at (100, 100) let region = Rectangle :: new ( Vector :: new ( 100.0 , 100.0 ) , image . size ( ) ) ; gfx . draw_image ( & image , region ) ; gfx . present ( & window ) ? ; loop { while let Some ( _ ) = input . next_event ( ) . await { } } }
This time we might return an error, so we use a Result
This time we might return an error so we use a Result
window
Window
gfx
Graphics
input
Input
window
Window
gfx
Graphics
input
Input