Function load_resource

Source
pub fn load_resource<T, D, M, R, F>(
    root: &mut Cursive,
    title: D,
    msg: M,
    task: R,
    finish_task: F,
)
where T: Send + Sync + 'static, D: Display, M: Into<StyledString>, R: FnOnce() -> T + Send + Sync + 'static, F: FnOnce(&mut Cursive, T) + Send + Sync + 'static,
Expand description

Convenience function that shows a loading pop up

ยงExample

let mut root = cursive::default();
root.set_theme(better_theme());
load_resource(&mut root,
    "Loading...", "Loading Dummy Number...",
    || {
        thread::sleep(Duration::from_secs(5));
        2 + 4
    },
    |root, val| {
        assert_eq!(val, 6);
        root.quit()
    }
);

root.run();