pub fn run_ui<F>(config: AppConfig, ui: F) -> Result<(), RunError>Expand description
Runs an application whose persistent state is captured by one UI closure.
This is the smallest entry point for applications that only build UI. Move to run_frame
when the closure needs fallibility, exit control, add-ons, or the current GPU generation. Use
run with an Application implementation when initialization, events, GPU recovery, or
teardown hooks are required. All three entries use the same runtime and recovery state machine.
Examples found in repository?
examples/hello.rs (lines 6-16)
3fn main() -> Result<(), RunError> {
4 let mut clicks = 0;
5
6 run_ui(AppConfig::default(), move |ui| {
7 ui.window("Hello")
8 .size([360.0, 160.0], Condition::FirstUseEver)
9 .build(|| {
10 if ui.button("Click me") {
11 clicks += 1;
12 }
13 ui.same_line();
14 ui.text(format!("Clicks: {clicks}"));
15 });
16 })
17}