#window #windows #async-version

wiard

Window handling library for Windows in Rust

18 releases

0.3.1 Oct 25, 2024
0.2.3 Oct 11, 2024
0.1.9 Jul 27, 2024
0.1.5 Mar 4, 2024
0.1.1 Nov 26, 2023

#323 in GUI


Used in 2 crates

MIT license

130KB
4K SLoC

wiard

Window handling library for Windows in Rust

Simple examples

sync version

fn main() {
    let mut event_rx = wiard::EventReceiver::new();
    let _window = wiard::Window::builder(&event_rx)
        .build()
        .unwrap();
    loop {
        let Some((event, _)) = event_rx.recv() else {
            break;
        };
        println!("{event:?}");
    }
}

async version

#[tokio::main]
async fn main() {
    let mut event_rx = wiard::AsyncEventReceiver::new();
    let _window = wiard::Window::builder(&event_rx)
        .await
        .unwrap();
    loop {
        let Some((event, _)) = event_rx.recv().await else {
            break;
        };
        println!("{event:?}");
    }
}

License

This library is licensed under the MIT license.


lib.rs:

Window handing library for Windows in Rust

Simple examples

sync version

fn main() {
    let mut event_rx = wiard::EventReceiver::new();
    let _window = wiard::Window::builder(&event_rx)
        .build()
        .unwrap();
    loop {
        let Some((event, _)) = event_rx.recv() else {
            break;
        };
        println!("{event:?}");
    }
}

async version

#[tokio::main]
async fn main() {
    let mut event_rx = wiard::AsyncEventReceiver::new();
    let _window = wiard::Window::builder(&event_rx)
        .await
        .unwrap();
    loop {
        let Some((event, _)) = event_rx.recv().await else {
            break;
        };
        println!("{event:?}");
    }
}

Note

wiard use WM_APP. Don't post directly WM_APP to wiard's UI thread.

Dependencies

~135MB
~2M SLoC