A light windows GUI toolkit for rust
Welcome to Native Windows GUI (aka NWG). A rust library to develop native GUI applications on the desktop for Microsoft Windows.
NWG is a very light wrapper over WINAPI. It allows you, the developer, to handle the quirks and rough edges of the API by providing a simple, safe and rust-like interface.
Native Windows GUI keeps things simple. This means small compile times, minimal resource usage, less time searching the documentation and more time for you to develop your application.
Of course, you don't have to take my word for it, check out the showcase and the examples.
This is the 3rd and final version of NWG. It is considered "mature" or, as I would say "the backlog is empty, and it will most likely stay that way". This version implements pretty much everything required to develop applications on Windows. Don't bother using the older versions as they have "irreconcilable design decisions" and cannot support some key features. Future development will be done in other libraries.
If you've managed to read through this introduction, you should know that my twitter handle is #gdube_dev and you can support this project with GitHub Sponsors.
Any support is greatly appreciated.
To use NWG in your project add it to cargo.toml:
[dependencies]
native-windows-gui = "1.0.12"
native-windows-derive = "1.0.3" # Optional. Only if the derive macro is used.And then, in main.rs or lib.rs :
extern crate native_windows_gui as nwg;
extern crate native_windows_derive as nwd; // Optional. Only if the derive macro is used.You can skip the extern crate define in your source code by adding the following code in Cargo.toml
Note that procedural macros still require an extern crate definition, so this wont work with native-windows-derive
[dependencies]
nwg = {version = "^1.0.12", package = "native-windows-gui"}See it for yourself. NWG has plenty of examples and a fully interactive test suite. The only thing you need to do is:
…Requirement: MinGW compiler
sudo apt install gcc-mingw-w64-x86-64Requirement: Rust support
rustup target add x86_64-pc-windows-gnuCompiling and running basic example:
cargo build --release --target=x86_64-pc-windows-gnu
cargo build --release --target=x86_64-pc-windows-gnu --example basic
wine target/x86_64-pc-windows-gnu/release/examples/basic.exeThis is the main project git. It is separated in multiple sections
https://zork.net/~st/jottings/rust-windows-and-debian.html for the steps to followThis was measured on a Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
In release mode, the basic example weighs 163kb on disk and takes 900kb in memory. Launch time is instantaneous.
The interactive test suite (with every feature and 100s of tests) weighs 931 kb on disk and takes 8MB in memory. Launch time is still instantaneous.
Initial build time takes around 22 seconds for a basic application. This is mainly due to winapi-rs initial compile time. Subsequent compile time takes around 0.7 seconds.
The development of this library is considered "done". By that, I mean that there won't be any change to the API. Issues can be raised if a bug is found or if some area in the documentation is unclear. If I overlooked a very important feature, it will most likely be added.
NWG uses the MIT license
………For the icons used in the test suite (and only there):
No open issues yet, or sync has not completed.