yeah-editor 0.1.0

yeah-editor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use xilem::view::{flex_col, label, text_button};
use xilem::winit::error::EventLoopError;
use xilem::{EventLoop, WidgetView, WindowOptions, Xilem};

struct Counter(i32);

fn app_logic(data: &mut Counter) -> impl WidgetView<Counter> + use<> {
    flex_col((
        label(format!("count: {}", data.0)),
        text_button("increment", |data: &mut Counter| data.0 += 1),
    ))
}

fn main() -> Result<(), EventLoopError> {
    let app = Xilem::new_simple(Counter(0), app_logic, WindowOptions::new("Xilem Minimal Counter"));
    app.run_in(EventLoop::with_user_event())?;
    Ok(())
}