winit_app

Crates.iowinit_app
lib.rswinit_app
version0.31.2
created_at2026-01-06 15:57:05.807999+00
updated_at2026-01-20 13:47:16.156719+00
descriptionA starter package to get started with winit windowing library
homepagehttps://opal-ui.github.io/winit-app-rs/
repositoryhttps://github.com/opal-ui/winit-app-rs
max_upload_size
id2026148
size54,739
Karthik K (akkumar)

documentation

README

winit_app crates.io

Winit App Starter Project

[dependencies]
winit_app = "0.31.2"

This Rust library winit_app represents the code to get started with winit Rust windowing library.

(To see more details about winit see here at - https://github.com/rust-windowing/winit )

This project can be used as a start quick launching pad based on the winit library.

Usage

use winit::{event::WindowEvent, window::WindowAttributes};
use winit_app::{AppWindowEvent, Application};

fn launch_app() -> Result<(), Box<dyn std::error::Error>> {
    let winit_app = Application::new();

    winit_app.run(
       WindowAttributes::default().with_title("Sample"),
       |app_window_event| match app_window_event {
           AppWindowEvent::NewWindow(_window) => {
               // TODO: Do something with this window
                
           }
           AppWindowEvent::OnWindowEvent(event, event_loop) => match event {
               WindowEvent::CloseRequested => {
                  // Just a default handler to exit the event_loop when window is being closed  
                   event_loop.exit();
               }
               _ => {
                   // Handle all other window events
               }
           },
       },
   )?;
   Ok(())
}

Credits

  • Winit Documentation and Examples

https://docs.rs/winit/latest/winit/

Commit count: 24

cargo fmt