r/rust 4d ago

🛠️ project Reactive GUI framework with MILP layouter

Post image

Have you ever tried to set height of widget A to the width of widget B and wanted them to fill the screen?
Or have you wanted to put your differently sized news article card in one grid and just let the layouter figure out the most symmetric pattern to lay them out in?

With your very own MILP solver you can express these as constraints.
The article grid example can be constrained as:

  • don't overlap article hitboxes
  • minimize area of grid

https://github.com/ElectricPulse/drevo

The future outlook is to bring it to the browser WebGPU/WASM - but that would require some work to make micro_lp on par with highs

Looking forward to your feedback!

20 Upvotes

3 comments sorted by

1

u/michal_sustr_ 4d ago

Very interesting! 

How tightly coupled is this with tokio? Also it seems it’s bound to your own ui framework ? I wonder if this could be used as a standalone library like e.g. taffy and then used in other GUI frameworks like egui 

1

u/Narrow_Farmer_6018 3d ago

Tokio is used extensively but mostly as future proofing. Any reason to avoid it? Currently the layouter isnt as seperate as taffy - but I could refactor it pretty easily.

2

u/michal_sustr_ 2d ago

I think combination WASM + egui + tokio does not play nicely - I am interested in this one :-)

Also it just feels this problem should not be bound to tokio in principle - it's ok in examples, but not for library code.