Skip to content

Commit

Permalink
Slightly improve error reporting in the example
Browse files Browse the repository at this point in the history
  • Loading branch information
DataTriny committed Nov 3, 2023
1 parent 23a6601 commit 5c6e1e4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions platforms/winit/examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl State {
}
}

fn main() {
fn main() -> Result<(), impl std::error::Error> {
println!("This example has no visible GUI, and a keyboard interface:");
println!("- [Tab] switches focus between two logical buttons.");
println!("- [Space] 'presses' the button, adding static text in a live region announcing that it was pressed.");
Expand All @@ -150,15 +150,14 @@ fn main() {
))]
println!("Enable Orca with [Super]+[Alt]+[S].");

let event_loop = EventLoopBuilder::with_user_event().build().unwrap();
let event_loop = EventLoopBuilder::with_user_event().build()?;

let state = State::new();

let window = WindowBuilder::new()
.with_title(WINDOW_TITLE)
.with_visible(false)
.build(&event_loop)
.unwrap();
.build(&event_loop)?;

let adapter = {
let state = Arc::clone(&state);
Expand All @@ -174,7 +173,7 @@ fn main() {

window.set_visible(true);

let _ = event_loop.run(move |event, event_loop| {
event_loop.run(move |event, event_loop| {
event_loop.set_control_flow(ControlFlow::Wait);

match event {
Expand Down Expand Up @@ -231,5 +230,5 @@ fn main() {
}
_ => (),
}
});
})
}

0 comments on commit 5c6e1e4

Please sign in to comment.