Crates.io | microui |
lib.rs | microui |
version | 0.2.5 |
source | src |
created_at | 2022-12-02 02:20:56.903459 |
updated_at | 2023-12-22 04:01:23.652786 |
description | MicroUI (immediate mode GUI) library in pure rust |
homepage | |
repository | https://github.com/NeoCogi/microui-rs |
max_upload_size | |
id | 728063 |
size | 229,365 |
This a port of Rxi's MicroUI to Rust language. We tried to keep the usage pattern as close to the original as possible, but also as idiomatic to Rust as possible. By no mean this library should be considered complete.
We used C2Rust to create the initial code and iterated > 60 times to get it to where it is now. Few bugs are lingering (Lost to translation!), be advised!
This is a relatively small project. And to be honest, it did not start with c2rust.
Rather, we forked microui and made few changes to the C code to make the generated more understandable. The fork can be found here. The C code modification mainly convert the pointer jumping to index jumping.
Otherwise, we have done the following:
std
, then use the rust standard library collections/containers). For us, to be faithful to the original design of microui, our objective is to provide a zero allocation microui. We created our own non-alloc containers for that.Clone and build the demo (SDL2 & glow) / Tested on linux:
$ cd demo-sdl2
$ cargo run
If you want to build the smallest executable:
$ cd demo-sdl2
$ cargo +nightly run --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu
This will give you a 127K
executable (with std)
We opt to use our own implementations for parsing/serializing decimals (not general purpose floats). The decimal representation is stored as float. This is not a general purpose floating point parser/serializer and the algorithm is rather naive. Keep that in mind!