xilem = { git = "https://github.com/linebender/xilem.git" }
# or
xilem = "0.4.0"
use xilem::style::Style;
use xilem::view::{label, sized_box};
use xilem::{EventLoop, WidgetView, WindowOptions, Xilem};
fn app_logic(_state: &mut ()) -> impl WidgetView<()> + use<> {
sized_box(label("Hello"))
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
.padding(1.0)
}
fn main() {
let app = Xilem::new_simple((), app_logic, WindowOptions::new("title"));
app.run_in(EventLoop::with_user_event()).unwrap();
}
┌──────────────┬─────────┬──────────┬─────────┐
│ Process Name │ % CPU │ Memory │ Threads │
├──────────────┼─────────┼──────────┼─────────┤
│ rustc │ 100.0 │ 14.59 GB │ 4 │
└──────────────┴─────────┴──────────┴─────────┘
This example failed to compile on my computer; rustc would consume tens of gigabytes of memory and eventually fail.
However, if you try reducing the use of .padding, it compiles very easily.
# macOS / Linux
rustc 1.95.0 (59807616e 2026-04-14)
This example failed to compile on my computer; rustc would consume tens of gigabytes of memory and eventually fail.
However, if you try reducing the use of
.padding, it compiles very easily.# macOS / Linux rustc 1.95.0 (59807616e 2026-04-14)