Macro report_error

Source
macro_rules! report_error {
    ($status_view:expr, $res_val:expr) => { ... };
}
Expand description

Convenience macro that updates the specified StatusView reference with an error message and returns from the current callback if an error happens, returns the Ok value otherwise

ยงExample

let mut root = cursive::default();
root.add_fullscreen_layer(
    hlayout!(
        Dialog::text("Yes")
            .button("Quit", Cursive::quit)
            .title("Error Reporting example")
        StatusView::new().with_name("status")
    )
);
root.set_fps(30);
root.set_global_callback(Event::Refresh, |root| {
    let error: Result<&str, &str> = Err("Error: Houston, we have a problem!");
    let mut status = root.find_name::<StatusView>("status").expect("StatusView does not exist!");
    report_error!(status, error);
    status.update();
});
root.run();